
Boris Gubenko wrote:
For the program below, in strict ansi mode, EDG Front End issues an error: "incomplete type is not allowed" (and, accordingly, cxx and aC++ issue this error also). g++ 4.2.1 does not issue any diagnostics, even when compiling '-pedantic -ansi'. Again, I'm not sure if a diagnostics is required in this case.
template <typename T> struct apply { typedef T type; };
template <typename T = void> struct vector;
template <typename Iterator> static typename apply<Iterator>::type call(Iterator) { return vector<>(); }
See 14.6/5:
No diagnostic shall be issued for a tem- plate definition for which a valid specialization can be generated. If no valid specialization can be generated for a template definition, and that template is not instantiated, it is unspecified whether or not an implementation is required to issue a diagnostic. The implementation is allowed to defer issuing a diagnostic until the function is instantiated.
Sebastian Redl