[cfe-dev] Template error without instantiation?
swlin at post.harvard.edu
Thu Apr 25 08:35:12 PDT 2013
> Could you please point me to where in the standard document does it say
> that compiler can reject a template if it has no valid instantiation,
> without actually being asked to instantiate it?
I'm not John, but the relevant paragraph seems to be 14.6p8:
"Knowing which names are type names allows the syntax of every
template to be checked. No diagnostic shall be issued for a template
for which a valid specialization can be generated. If no valid
specialization can be generated for a template, and that template is
not instantiated, the template is ill-formed, no diagnostic required.
If every valid specialization of a variadic template requires an empty
template parameter pack, the template is ill-formed, no diagnostic
required. If a type used in a non-dependent name is incomplete at the
point at which a template is defined but is complete at the point at
which an instantiation is done, and if the completeness of that type
affects whether or not the program is well-formed or affects the
semantics of the program, the program is ill-formed; no diagnostic is
More information about the cfe-dev