Bug 47482 - [4.6 Regression] [C++0x] ICE: unexpected expression ‘sizeof ("A")’ of kind sizeof_expr
Summary: [4.6 Regression] [C++0x] ICE: unexpected expression ‘sizeof ("A")’ of kind si...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.0
: P1 normal
Target Milestone: 4.6.0
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2011-01-26 22:39 UTC by Jonathan Wakely
Modified: 2011-02-14 22:08 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.4.6, 4.5.3
Known to fail:
Last reconfirmed: 2011-01-27 03:32:25


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Wakely 2011-01-26 22:39:30 UTC
template<class>
struct K
{
   enum { A = sizeof"A" , B = +A };
};

ice.cc:4:32: internal compiler error: unexpected expression ‘sizeof ("A")’ of kind sizeof_expr
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


works with 4.4 & 4.5, or without -std=c++0x
Comment 1 Jonathan Wakely 2011-01-26 22:41:50 UTC
the ICE goes away if K is not a template or if B is initialized with simply A, rather than an expression involving A
Comment 2 H.J. Lu 2011-01-27 03:32:25 UTC
It is caused by revision 166167:

http://gcc.gnu.org/ml/gcc-cvs/2010-11/msg00053.html
Comment 3 Jason Merrill 2011-02-11 19:44:46 UTC
Got it.
Comment 4 Jason Merrill 2011-02-14 21:52:28 UTC
Author: jason
Date: Mon Feb 14 21:52:24 2011
New Revision: 170156

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170156
Log:
	PR c++/47482
	* parser.c (cp_parser_enumerator_definition): Call
	fold_non_dependent_expr.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/regress/enum1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 Jakub Jelinek 2011-02-14 22:08:39 UTC
Fixed.