Bug 40371

Summary: ICE with template operator
Product: gcc Reporter: Volker Reichelt <reichelt>
Component: c++Assignee: Paolo Carlini <paolo.carlini>
Status: RESOLVED FIXED    
Severity: normal CC: bangerth, gcc-bugs
Priority: P3 Keywords: ice-on-invalid-code, monitored
Version: 4.5.0   
Target Milestone: 4.5.0   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2009-08-25 15:35:35

Description Volker Reichelt 2009-06-07 20:35:31 UTC
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.]
Comment 1 Wolfgang Bangerth 2009-08-25 15:35:35 UTC
Confirmed.
Comment 2 Paolo Carlini 2009-11-30 18:41:30 UTC
Patch here: http://gcc.gnu.org/ml/gcc-patches/2009-11/msg01729.html
Comment 3 paolo@gcc.gnu.org 2009-11-30 22:45:21 UTC
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

Comment 4 Paolo Carlini 2009-11-30 22:46:15 UTC
Fixed.