The following invalid code snippet triggers an ICE on mainline: ===================================================================== template<typename... T> struct A { void foo(T*) { ++p; } T* p; }; ===================================================================== bug.cc:3: error: parameter packs not expanded with `...': bug.cc:3: note: 'T' bug.cc: In member function 'void A<T>::foo(<type error>)': bug.cc:3: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in build_unary_op, at cp/typeck.c:4296 Please submit a full bug report, [etc.] The testcase didn't crash before 2007-11-03, so it's probably fallout from http://gcc.gnu.org/ml/gcc-cvs/2007-11/msg00120.html
The set_packs_to_error stuff is very problematic in this case, because trees are shared and the C++ FE certainly doesn't expect error_mark_nodes to appear at random places. In this case T* type is shared (as the pointer to T has been cached). check_for_bare_parameter_packs should have errored about this twice, but will do only once because of the sharing and in the second case just won't fail, so doesn't let the caller to deal with the errorneous type.
Testing a fix.
Subject: Bug 34056 Author: jakub Date: Tue Nov 13 18:27:09 2007 New Revision: 130152 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130152 Log: PR c++/34054 PR c++/34056 PR c++/34057 PR c++/34058 PR c++/34060 * pt.c (find_parameter_packs_r): If ppd->set_packs_to_error, set to error_mark_node the outermost POINTER_TYPE to the pack if it is seen in a POINTER_TYPE. (push_template_decl_real): If check_for_bare_parameter_packs fails for function return type, set the return type to integer_type_node. If check_for_bare_parameter_packs failed for non-function, return error_mark_node. * g++.dg/parse/crash36.C: Add another dg-error. * g++.dg/cpp0x/pr34054.C: New test. * g++.dg/cpp0x/pr34056.C: New test. * g++.dg/cpp0x/pr34057.C: New test. * g++.dg/cpp0x/pr34058.C: New test. * g++.dg/cpp0x/pr34060.C: New test. Added: trunk/gcc/testsuite/g++.dg/cpp0x/pr34054.C trunk/gcc/testsuite/g++.dg/cpp0x/pr34056.C trunk/gcc/testsuite/g++.dg/cpp0x/pr34057.C trunk/gcc/testsuite/g++.dg/cpp0x/pr34058.C trunk/gcc/testsuite/g++.dg/cpp0x/pr34060.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/parse/crash36.C
Fixed.