Bug 40373 - [4.3/4.4/4.5 Regression] ICE with invalid destructor call
Summary: [4.3/4.4/4.5 Regression] ICE with invalid destructor call
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P5 normal
Target Milestone: 4.3.4
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2009-06-07 20:49 UTC by Volker Reichelt
Modified: 2009-06-08 17:03 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-06-08 14:01:21


Attachments
gcc45-pr40373.patch (555 bytes, patch)
2009-06-08 14:47 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2009-06-07 20:49:55 UTC
The following invalid code snippet triggers an ICE:

======================================
struct A;
namespace { struct A; }

struct B {};

template<typename T> void foo(T t)
{
  t.~A();
}

void bar()
{
  foo(B());
}
======================================

bug.cc: In function 'void foo(T)':
bug.cc:8:6: error: reference to 'A' is ambiguous
bug.cc:1:8: error: candidates are: struct A
bug.cc:2:20: error:                 struct<unnamed>::A
bug.cc: In function 'void foo(T) [with T = B]':
bug.cc:13:10:   instantiated from here
bug.cc:8:3: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in check_dtor_name, at cp/call.c:247
Please submit a full bug report, [etc.]

The bug affects the trunk, the 4.4 branch, and the 4.3 branch.
The bug was introduced on the 4.3 branch after the release of GCC 4.3.3.
Comment 1 H.J. Lu 2009-06-08 14:01:21 UTC
It is caused by revision 143502:

http://gcc.gnu.org/ml/gcc-cvs/2009-01/msg00515.html
Comment 2 Jakub Jelinek 2009-06-08 14:47:36 UTC
Created attachment 17967 [details]
gcc45-pr40373.patch

Possible fix.
Comment 3 Richard Biener 2009-06-08 15:42:05 UTC
WONTFIX for 4.3/4.4 branches.
Comment 4 Jason Merrill 2009-06-08 16:19:16 UTC
I think it should be fixed in 4.3/4.4 since the bug wasn't present in 4.3.3 and the fix is trivial.
Comment 5 Jakub Jelinek 2009-06-08 16:48:25 UTC
Subject: Bug 40373

Author: jakub
Date: Mon Jun  8 16:48:11 2009
New Revision: 148282

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148282
Log:
	PR c++/40373
	* call.c (check_dtor_name): Return false even if
	get_type_value (name) is error_mark_node.

	* g++.dg/template/dtor7.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/template/dtor7.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/testsuite/ChangeLog

Comment 6 Jakub Jelinek 2009-06-08 16:49:30 UTC
Subject: Bug 40373

Author: jakub
Date: Mon Jun  8 16:49:17 2009
New Revision: 148283

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148283
Log:
	PR c++/40373
	* call.c (check_dtor_name): Return false even if
	get_type_value (name) is error_mark_node.

	* g++.dg/template/dtor7.C: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/dtor7.C
Modified:
    branches/gcc-4_4-branch/gcc/cp/ChangeLog
    branches/gcc-4_4-branch/gcc/cp/call.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog

Comment 7 Jakub Jelinek 2009-06-08 17:02:45 UTC
Subject: Bug 40373

Author: jakub
Date: Mon Jun  8 17:02:17 2009
New Revision: 148284

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148284
Log:
	PR c++/40373
	* call.c (check_dtor_name): Return false even if
	get_type_value (name) is error_mark_node.

	* g++.dg/template/dtor7.C: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/template/dtor7.C
Modified:
    branches/gcc-4_3-branch/gcc/cp/ChangeLog
    branches/gcc-4_3-branch/gcc/cp/call.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog

Comment 8 Jakub Jelinek 2009-06-08 17:03:46 UTC
Fixed for 4.3/4.4/4.5.