------- Additional Comments From giovannibajo at libero dot it 2005-06-04 10:46 ------- I can't find anything in the standard which says that this should be an error, regardless of what Comeau does. This looks like a genuine bug in the parser, see parser.c:cp_parser_class_specifier: the parsing of the body of the in- classe defined functions and default arguments is delayed until the whole class definition is parsed (this allows, eg., the body of in-class member functions to refer to other member functions which appear later within the struct definition).
There is some code which also delays inner functions until the outer function is finished: /* If this class is not itself within the scope of another class, then we need to parse the bodies of all of the queued function definitions. Note that the queued functions defined in a class are not always processed immediately following the class-specifier for that class. Consider: struct A { struct B { void f() { sizeof (A); } }; }; If `f' were processed before the processing of `A' were completed, there would be no way to compute the size of `A'. Note that the nesting we are interested in here is lexical -- not the semantic nesting given by TYPE_CONTEXT. In particular, for: struct A { struct B; }; struct A::B { void f() { } }; there is no need to delay the parsing of `A::B::f'. */ I think this logic breaks down with instantiations: probably the DEFAULT_ARG nodes (representing an unparsed default argument) are copied from B<T> (generic template) into B<int> (implicit specialization created by instantiation), and never reparsed after that (in fact, I can't see how they could be put within parser->unparser_function_queue, which is private of the parser). I did not check whether this is a regression or not. -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed| |1 Last reconfirmed|0000-00-00 00:00:00 |2005-06-04 10:46:16 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21903