From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18964 invoked by alias); 5 Aug 2003 23:16:55 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 18957 invoked by uid 48); 5 Aug 2003 23:16:55 -0000 Date: Tue, 05 Aug 2003 23:16:00 -0000 From: "reichelt at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org Message-ID: <20030805231654.11815.reichelt@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/11815] New: ICE with missing template keyword X-Bugzilla-Reason: CC X-SW-Source: 2003-08/txt/msg00749.txt.bz2 List-Id: PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11815 Summary: ICE with missing template keyword Product: gcc Version: 3.4 Status: UNCONFIRMED Keywords: ice-on-invalid-code, error-recovery, diagnostic Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: reichelt at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org This is a spin-off from PR 6023: Consider the following invalid code (which is missing a "template" keyword righ before "X" in line 5): ------------------------------------------- template struct A; template struct B { template void foo(const typename A::X::Y&); template void bar(U x) { foo<0>(x); } }; ------------------------------------------- Compiling this with mainline, one gets the following error message: bug.cc:5: error: expected primary-expression bug.cc:5: error: expected primary-expression bug.cc:5: error: `::Y' has not been declared bug.cc:5: error: expected primary-expression bug.cc:5: error: variable or field `foo' declared void bug.cc:5: error: ISO C++ forbids initialization of member `foo' bug.cc:5: error: making `foo' static bug.cc:5: error: ISO C++ forbids in-class initialization of non-const static member `foo' bug.cc:5: error: template declaration of `int B::foo' bug.cc: In member function `void B::bar(U)': bug.cc:6: internal compiler error: in cp_parser_template_id, at cp/parser.c: 7516 Please submit a full bug report, [etc.] This is rewarded with three keywords: "ice-on-invalid-code", "error-recovery" (since the ICE happens after a error message), and "diagnostic" (since the error message is not very helpful - we are missing just one "template", remember). Nevertheless, this is actually an improvement since the code was wrongly accepted by gcc 2.95.x - 3.3.x. Btw, by varying the declaration of foo (i.e. removing "&", "const", or "::Y") one can change the error message a little.