https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66686
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> --- (In reply to Martin Sebor from comment #1) > The code doesn't look valid to me: Y is not a valid template argument for > the template template parameter C. But once "struct X" gets instantiated like in the very last line, doesn't it become a valid template argument? There, B is set to int, thus the template parameter C gets the type "template <int> class" which is exactly the type of the template Y.