Consider this test case: template <class T> class Foo { public: typedef T bar; int x; T z; }; template <class T> class Test: public Foo<T> { public: typedef T * t2; typedef Foo<T> F; t2 t; F f; typename F::bar b; typename Foo<T>::bar b2; F::bar b3; Foo<T>::bar b4; }; Test<int> T2; GCC 3.3.3 complains about the declarations of b3 and b4, saying that it's an implicit typename and that's deprecated. GCC 3.4.0 rejects the code outright. Given that it's the next version, and it was deprecated, that's ok. What's not ok is the error message: foo.cc:18: error: expected `;' before "b3" foo.cc:19: error: expected `;' before "b4" This gives no clue at all about what the problem is or how to correct it.
Confirmed.
*** Bug 18451 has been marked as a duplicate of this bug. ***
*** Bug 36353 has been marked as a duplicate of this bug. ***
*** Bug 40738 has been marked as a duplicate of this bug. ***
Subject: Bug 15946 Author: jason Date: Fri Nov 6 21:18:42 2009 New Revision: 153978 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153978 Log: PR c++/15946 * parser.c (cp_parser_check_template_parameters): Don't talk about specialization at function scope. (cp_parser_diagnose_invalid_type_name): Handle dependent scope. (cp_parser_parse_and_diagnose_invalid_type_name): Likewise. (cp_parser_expression_statement): Suggest typename. * error.c (dump_decl) [SCOPE_REF]: Print the type here. (dump_expr) [SCOPE_REF]: Call it. (dump_type) [UNBOUND_CLASS_TEMPLATE]: Check TFF_UNQUALIFIED_NAME. * cxx-pretty-print.c (pp_cxx_unqualified_id): Print class template args. Added: trunk/gcc/testsuite/g++.dg/parse/error36.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cxx-pretty-print.c trunk/gcc/cp/error.c trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/template/error26.C trunk/gcc/testsuite/g++.old-deja/g++.other/typename1.C
*** Bug 35228 has been marked as a duplicate of this bug. ***
*** Bug 15179 has been marked as a duplicate of this bug. ***
Fixed for 4.5.