----------------------------------------------------- template <class T> struct Base {}; template <class T> struct Derived: public Base<T> { typename Derived::template Base<double>* p1; }; template struct Derived<void>; ----------------------------------------------------- test.cc:3: error: no class template named `Base' in `struct Derived<T>' test.cc:3: internal compiler error: tree check: expected class 't', have 'x' (error_mark) in cp_parser_class_name, at cp/parser.c:11594 The problem appears to be that make_typename_type does perform a name lookup within the currently open class, while cp_parser_template_name does not. I think they both have to agree on what to do. Besides, the lookup should not fail (see DR176, and g++.dg/tc1/dr176.C which I will soon submit). So this is both a rejects-valid and an ice-on-valid.
Confirmed, the ICE is a regression from 3.3.3
Subject: Bug 13950 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2004-02-03 20:00:47 Modified files: gcc/testsuite : ChangeLog gcc/cp : ChangeLog parser.c Added files: gcc/testsuite/g++.dg/template: lookup4.C gcc/testsuite/g++.dg/parse: error14.C Log message: PR c++/13950 * parser.c (cp_parser_class_name): Robustify. PR c++/13970 * parser.c (cp_parser_cache_group): Do not consume the EOF token. PR c++/13950 * g++.dg/template/lookup4.C: New test. PR c++/13970 * g++.dg/parse/error14.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3459&r2=1.3460 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3927&r2=1.3928 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.166&r2=1.167 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/lookup4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/error14.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 13950 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: mmitchel@gcc.gnu.org 2004-02-03 20:04:36 Modified files: gcc/cp : ChangeLog parser.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/parse: error14.C gcc/testsuite/g++.dg/template: lookup4.C Log message: PR c++/13950 * parser.c (cp_parser_class_name): Robustify. PR c++/13970 * parser.c (cp_parser_cache_group): Do not consume the EOF token. PR c++/13950 * g++.dg/template/lookup4.C: New test. PR c++/13970 * g++.dg/parse/error14.C: New test. Patches: 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.31&r2=1.3892.2.32 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.8&r2=1.157.2.9 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.47&r2=1.3389.2.48 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/error14.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/lookup4.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
The ICE is fixed in GCC 3.4. Therefore, this is no longer a regression, and I have removed the target milestone.
Subject: Bug 13950 Author: jason Date: Mon Nov 16 23:29:25 2009 New Revision: 154223 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154223 Log: PR c++/13950, DR 176 * search.c (lookup_field_r): Allow lookup to find the injected-class-name from a template base. (template_self_reference_p): Remove. * decl.c (make_typename_type): Diagnose ambiguity. Use maybe_get_template_decl_from_type_decl. * parser.c (cp_parser_template_name): Pass true to is_template rather than use maybe_get_template_decl_from_type_decl. (cp_parser_lookup_name): Use maybe_get_template_decl_from_type_decl. * pt.c (maybe_get_template_decl_from_type_decl): Handle ambiguity. Use DECL_SELF_REFERENCE_P. * parser.c (cp_parser_parse_and_diagnose_invalid_type_name): Avoid duplicate ambiguity error. * error.c (dump_decl): Don't say "typedef" for injected-class-name. * pt.c (convert_template_argument): Tweak logic. Added: trunk/gcc/testsuite/g++.dg/template/injected1.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/cp/error.c trunk/gcc/cp/parser.c trunk/gcc/cp/pt.c trunk/gcc/cp/search.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/template/inherit.C trunk/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C trunk/gcc/testsuite/g++.old-deja/g++.pt/lookup8.C trunk/gcc/testsuite/g++.old-deja/g++.pt/ttp22.C trunk/gcc/testsuite/g++.old-deja/g++.pt/ttp23.C
Fixed for 4.5.
*** This bug has been marked as a duplicate of 189 ***