http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50859
Bug #: 50859 Summary: ICE when creating integral constant from real value in a template Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: bitbuc...@mailinator.com $ curl 'http://169.254.169.254/latest/meta-data/ami-id' && echo ami-21f53948 $ cat /etc/issue Ubuntu 11.10 \n \l $ uname -a Linux domU-12-31-39-12-AC-DE 3.0.0-12-virtual #20-Ubuntu SMP Fri Oct 7 18:19:02 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux $ g++ --version g++ (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ cat ice.cc template <class T> void f() { const int INTEGRAL_CONSTANT = 1.0; } $ g++ ice.cc ice.cc: In function ‘void f()’: ice.cc:3:33: internal compiler error: in fold_convert_const_int_from_real, at fold-const.c:1562 Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions. Preprocessed source stored into /tmp/ccRBRVx3.out file, please attach this to your bugreport. $ cat /tmp/ccRBRVx3.out // /usr/lib/gcc/x86_64-linux-gnu/4.6.1/cc1plus -quiet -imultilib . -imultiarch x86_64-linux-gnu -D_GNU_SOURCE ice.cc -quiet -dumpbase ice.cc -mtune=generic -march=x86-64 -auxbase ice -fstack-protector -o - -frandom-seed=0 # 1 "ice.cc" # 1 "<built-in>" # 1 "<command-line>" # 1 "ice.cc" template <class T> void f() { const int INTEGRAL_CONSTANT = 1.0; } $ This error does not appear in g++ 4.4.1