The following code snippet triggers an ICE on mainline (I'm not sure whether this is valid or not): =============================== template<int> struct A; void foo() { __decltype A<0>; } =============================== bug5.cc: In function 'void foo()': bug5.cc:9: internal compiler error: in cp_parser_lookup_name, at cp/parser.c:16084 Please submit a full bug report, [etc.] The problem appeared between 2007-07-16 and 2007-08-15, presumably with the introduction of decltype: 2007-07-27 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (structural_comptypes): Compare DECLTYPE_TYPE nodes. * cp-tree.def (DECLTYPE_TYPE): New. * error.c (dump_type): Dump DECLTYPE_TYPE nodes. ...
The code should be invalid precisely because this is also invalid: ------------------- template<int> struct A; void foo() { A<0>; } ------------------- g/x> c++ -c x.cc x.cc: In function 'void foo()': x.cc:5: error: declaration does not declare anything W.
Subject: Bug 33839 Author: dgregor Date: Fri Oct 26 17:53:56 2007 New Revision: 129656 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129656 Log: 2007-10-26 Douglas Gregor <doug.gregor@gmail.com> PR c++/33839 * parser.c (cp_parser_decltype): Return ERROR_MARK_NODE if we don't see the leading '('. Only lookup names if we get an IDENTIFIER_NODE. 2007-10-26 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/cpp0x/pr33839.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp0x/pr33839.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
Fixed. The testcase is invalid code, but we shouldn't crash on it. Now we don't.
*** Bug 33837 has been marked as a duplicate of this bug. ***
*** Bug 33838 has been marked as a duplicate of this bug. ***