A broken diagnostic is issued for the following invalid code snippet on trunk: ================================ template<int> struct A { template<int> struct B; }; int i = A<0>::B<0>::X::Y; ================================ bug.cc:6:21: error: 'A<0>::B<#'tree_vec' not supported by pp_c_expression#, #'tree_vec' not supported by pp_c_expression#>::X' has not been declared GCC 4.3.x and 4.4.x issue a sensible error message: bug.cc:6: error: 'A::B::X' has not been declared GCC 4.2.x issues an even better error message: bug.cc:6: error: 'struct A<0>::B<0>::X' has not been declared
Confirmed.
A patch got submitted to http://gcc.gnu.org/ml/gcc-patches/2009-12/msg00208.html
Subject: Bug 42218 Author: dodji Date: Fri Dec 4 07:38:42 2009 New Revision: 154972 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154972 Log: Fix PR c++/42218 gcc/cp/ChangeLog: PR c++/42218 * cxx-pretty-print.c (pp_cxx_unqualified_id): Print only innermost template arguments. gcc/testsuite/ChangeLog: PR c++/42218 * g++.dg/other/error33.C: New test. Added: trunk/gcc/testsuite/g++.dg/other/error33.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cxx-pretty-print.c trunk/gcc/testsuite/ChangeLog
Fixed in 4.5