https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89741
Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #5) > This needs to be verified by our C++ language lawyers, but if: > "If no valid specialization can be generated for a template definition, and > that template is not instantiated, the template definition is ill-formed, no > diagnostic required." > rule applies in this case, then what you are trying to do is not valid C++ Right. G++ is giving a correct, though optional, diagnostic; if you want to delay this diagnostic until instantiation, you need to make the expression somehow dependent on template arguments.