Bug 40371 - ICE with template operator
Summary: ICE with template operator
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Paolo Carlini
URL:
Keywords: ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2009-06-07 20:35 UTC by Volker Reichelt
Modified: 2009-11-30 22:46 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-08-25 15:35:35


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.