The following invalid code snippet triggers an ICE since at least GCC 2.95.3: ================================= struct A { typedef void (&F)(); template<int> operator F(); }; void foo() { A()(); } ================================= bug.cc: In function 'void foo()': bug.cc:9:7: internal compiler error: in add_template_candidate_real, at cp/call.c:2477 Please submit a full bug report, [etc.]
Confirmed.
Patch here: http://gcc.gnu.org/ml/gcc-patches/2009-11/msg01729.html
Subject: Bug 40371 Author: paolo Date: Mon Nov 30 22:45:06 2009 New Revision: 154852 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154852 Log: cp/ 2009-11-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/40371 * call.c (add_template_candidate_real): Early return NULL if the arglist length is smaller than skip_without_in_chrg; tidy. testsuite/ 2009-11-30 Paolo Carlini <paolo.carlini@oracle.com> PR c++/40371 * g++.dg/template/crash93.C: New. Added: trunk/gcc/testsuite/g++.dg/template/crash93.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/call.c trunk/gcc/testsuite/ChangeLog
Fixed.