Following (valid I believe) code causes internal compiler error: enum class E : char { e1, e2 };
inline E operator| (E a1, E a2) { char ret = static_cast<char> (a1) | static_cast<char> (a2); return static_cast<E>(ret); } g++-4.4.0-alpha20081010 -v -c -std=c++0x enum_class_ice.cc Using built-in specs. Target: i686-pc-linux-gnu Configured with: /var/tmp/paludis/sys-devel-gcc-4.4.0_alpha20081010/work/gcc-4.4-20081010/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.4.0-alpha20081010 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.0-alpha20081010 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.0-alpha20081010/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.0-alpha20081010/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/include/g++-v4 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --enable-cld --disable-libgcj --with-arch=i686 --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.4.0_alpha20081010' Thread model: posix gcc version 4.4.0-alpha20081010 (experimental) (Gentoo 4.4.0_alpha20081010) COLLECT_GCC_OPTIONS='-v' '-c' '-std=c++0x' '-E' '-shared-libgcc' '-mtune=generic' '-march=i686' /usr/libexec/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/cc1plus -E -quiet -v -D_GNU_SOURCE enum_class_ice.cc -mtune=generic -march=i686 -std=c++0x ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/../../../../i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/include/g++-v4 /usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/include/g++-v4/i686-pc-linux-gnu /usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/include/g++-v4/backward /usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/include /usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/include-fixed /usr/include End of search list. COMPILER_PATH=/usr/libexec/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/:/usr/libexec/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/:/usr/libexec/gcc/i686-pc-linux-gnu/:/usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/:/usr/lib/gcc/i686-pc-linux-gnu/:/usr/libexec/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/:/usr/libexec/gcc/i686-pc-linux-gnu/:/usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/:/usr/lib/gcc/i686-pc-linux-gnu/:/usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/../../../../i686-pc-linux-gnu/bin/ LIBRARY_PATH=/usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/:/usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/:/usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/../../../../i686-pc-linux-gnu/lib/:/usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-c' '-std=c++0x' '-E' '-shared-libgcc' '-mtune=generic' '-march=i686' Using built-in specs. Target: i686-pc-linux-gnu Configured with: /var/tmp/paludis/sys-devel-gcc-4.4.0_alpha20081010/work/gcc-4.4-20081010/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.4.0-alpha20081010 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.0-alpha20081010 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.0-alpha20081010/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.0-alpha20081010/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/include/g++-v4 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --enable-cld --disable-libgcj --with-arch=i686 --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.4.0_alpha20081010' Thread model: posix gcc version 4.4.0-alpha20081010 (experimental) (Gentoo 4.4.0_alpha20081010) COLLECT_GCC_OPTIONS='-v' '-c' '-std=c++0x' '-o' '/home/prak/.ccache/tmp.hash.sandra.23558.o' '-shared-libgcc' '-mtune=generic' '-march=i686' /usr/libexec/gcc/i686-pc-linux-gnu/4.4.0-alpha20081010/cc1plus -fpreprocessed /home/prak/.ccache/enum_class.tmp.sandra.23558.ii -quiet -dumpbase enum_class.tmp.sandra.23558.ii -mtune=generic -march=i686 -auxbase-strip /home/prak/.ccache/tmp.hash.sandra.23558.o -std=c++0x -version -o /tmp/ccpib1aZ.s GNU C++ (Gentoo 4.4.0_alpha20081010) version 4.4.0-alpha20081010 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 4.4.0-alpha20081010 (experimental), GMP version 4.2.4, MPFR version 2.3.2. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 3bd1a7449bb261a218b8d8c78fb46226 enum_class_ice.cc: In function E operator|(E, E): enum_class_ice.cc:10: internal compiler error: in common_type, at cp/typeck.c:779 Please submit a full bug report, with preprocessed source if appropriate. See <http://bugs.gentoo.org/> for instructions. -- Summary: ICE with enum class Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: piotr dot rak at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37946