-pedantic too pedantic about templates

Martin v. Loewis martin@mira.isdn.cs.tu-berlin.de
Mon May 31 21:06:00 GMT 1999

> // sts@ica1.uni-stuttgart.de
> // should compile (with -pedantic) and return 0  

No, the code is ill-formed.

>   { return Outer<N-1>::Inner(n); }

This is a dependant name, so Outer<N-1>::Inner is considered as an
object; the whole thing should be function call (or operator()
invocation). As it turns out, Outer<1>::Inner is a type, so the
construct is ill-formed. The correct notation would be 

   { return typename Outer<N-1>::Inner(n); }

Hope this helps,

More information about the Gcc-bugs mailing list