The diagnostic for the following invalid code snippet could be improved: ================================= template<typename> struct A {}; namespace N {} A<N> a; ================================= On mainline we now get: bug5.cc:5: error: template argument 1 is invalid bug5.cc:5: error: template argument 1 is invalid bug5.cc:5: error: template argument 1 is invalid bug5.cc:5: error: template argument 1 is invalid bug5.cc:5: error: template argument 1 is invalid bug5.cc:5: error: template argument 1 is invalid bug5.cc:5: error: template argument 1 is invalid bug5.cc:5: error: template argument 1 is invalid bug5.cc:5: error: expected constructor, destructor, or type conversion before '<' token With 3.3.5 we get: bug5.cc:5: error: use of namespace `N' as expression bug5.cc:5: error: template argument 1 is invalid bug5.cc:5: error: ISO C++ forbids declaration of `a' with no type which is okay IMHO. With 3.4.3 we get bug5.cc:5: error: template argument 1 is invalid bug5.cc:5: error: invalid type in declaration before ';' token which is less informative, but still okay. With the current 3.4 branch we almost get the same mess as with mainline.
Alexandre, this was probably caused by your patch for PR18757: http://gcc.gnu.org/ml/gcc-cvs/2004-12/msg00382.html
Confirmed.
Alexandre, this patch was clearly incorrect. The whole reason to create CPP_TEMPLATE_ID tokens is to avoid re-parsing the same token sequence in the case that an error occurred. Please revert this patch ASAP. Feel free to assign the original bug which your patch fixed to me.
Subject: Bug 19499 CVSROOT: /cvs/gcc Module name: gcc Changes by: aoliva@gcc.gnu.org 2005-02-01 05:56:08 Modified files: gcc/testsuite : ChangeLog gcc/cp : ChangeLog parser.c pt.c gcc/testsuite/g++.dg/parse: typename7.C Log message: gcc/cp/ChangeLog: PR c++/18757 PR c++/19366 PR c++/19499 * parser.c (cp_parser_template_id): Revert 2004-12-09's patch. Issue an error when creating the template id. * pt.c (fn_type_unification): Return early if the explicit template arg list is an error_mark_node. gcc/testsuite/ChangeLog: * g++.dg/parse/typename7.C: Adjust error messages. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4967&r2=1.4968 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4607&r2=1.4608 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.306&r2=1.307 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.970&r2=1.971 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/typename7.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
Subject: Bug 19499 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: aoliva@gcc.gnu.org 2005-02-01 07:04:01 Modified files: gcc/testsuite : ChangeLog gcc/cp : ChangeLog parser.c pt.c gcc/testsuite/g++.dg/parse: typename7.C Log message: gcc/cp/ChangeLog: PR c++/18757 PR c++/19366 PR c++/19499 * parser.c (cp_parser_template_id): Revert 2004-12-09's patch. Issue an error when creating the template id. * pt.c (fn_type_unification): Return early if the explicit template arg list is an error_mark_node. gcc/testsuite/ChangeLog: * g++.dg/parse/typename7.C: Adjust error messages. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.354&r2=1.3389.2.355 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.193&r2=1.3892.2.194 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.157.2.50&r2=1.157.2.51 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.49&r2=1.816.2.50 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/typename7.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1.10.1&r2=1.1.10.2
Fixed in 3.4.4 and 4.0.0.