Bug 47277 - [C++0x] pseudo destructor code that cause an internal compiler error with std=gnu++0x
Summary: [C++0x] pseudo destructor code that cause an internal compiler error with std...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.1
Assignee: Jason Merrill
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2011-01-13 08:57 UTC by Christian Bornträger
Modified: 2011-05-29 00:39 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.5.2, 4.6.0
Last reconfirmed: 2011-01-13 09:54:56


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Bornträger 2011-01-13 08:57:31 UTC
I have a testcases that triggered an ICE:

$ /space/gcc/install-trunk/bin/g++ -std=gnu++0x -W test.cc   
test.cc: In function 'int main()':
test.cc:4:18: internal compiler error: in constructor_name_p, at cp/name-lookup.c:1846
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

This is the minimized testcase:

int main(void) {
           enum e {};
           e ev;
           ev.e::~e_u();
}
Comment 1 Jonathan Wakely 2011-01-13 09:54:56 UTC
confirmed
Comment 2 Paolo Carlini 2011-05-25 14:52:26 UTC
Very likely due to the fix for c++/48935, we don't ICE anymore. However, as I noticed when I tried to fix this one, we always print:

  ‘main()::e::~e’

in the error message for line #4, that is, there is code in the front-end which disregards the actual '~e_u()'. Should this be improved as part of these PRs?
Comment 3 Jason Merrill 2011-05-27 19:32:18 UTC
Author: jason
Date: Fri May 27 19:32:14 2011
New Revision: 174355

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174355
Log:
	PR c++/47277
	* parser.c (cp_parser_unqualified_id): Don't check
	constructor_name_p for enums.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/enum18.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Paolo Carlini 2011-05-27 19:33:30 UTC
Oops, sorry about the wrong remark about the disappeared ICE, I had the compiler built with checking disabled to speed up library library testing. The rest of the comment lives, however ;)
Comment 5 Jason Merrill 2011-05-27 20:48:27 UTC
Author: jason
Date: Fri May 27 20:48:24 2011
New Revision: 174363

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174363
Log:
	PR c++/47277
	* parser.c (cp_parser_unqualified_id): Don't check
	constructor_name_p for enums.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/enum18.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/parser.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 6 Jason Merrill 2011-05-28 22:01:32 UTC
Author: jason
Date: Sat May 28 22:01:28 2011
New Revision: 174385

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174385
Log:
	PR c++/47277
	* parser.c (cp_parser_pseudo_destructor_name): Commit to parse
	after we see the ~.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/cpp0x/enum18.C
Comment 7 Jason Merrill 2011-05-29 00:39:37 UTC
ICE fixed for 4.6.1, error improved for 4.7.0.