Consider this test case:
template <class T> class Foo
typedef T bar;
template <class T> class Test: public Foo<T>
typedef T * t2;
typedef Foo<T> F;
typename F::bar b;
typename Foo<T>::bar b2;
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.
*** 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
Date: Fri Nov 6 21:18:42 2009
New Revision: 153978
* 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_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
*** 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.