http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58176
Bug ID: 58176 Summary: ICE in output_constant, at varasm.c:4658 Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mralert at gmail dot com Code: // Nil struct nil_ { constexpr nil_ () {} }; constexpr nil_ nil; // Cons template <class H, class T = nil_> struct cons_ { using head_ = H; using tail_ = T; H head; T tail; constexpr cons_() {} constexpr cons_(H const &h, T const &t) : head(h), tail(t) {} }; template <class H, class T = nil_> constexpr cons_<H, T> cons (H const &h, T const &t = nil) { return cons_<H,T>(h,t); } // List template <class... T> struct list_s; template <class H, class... T> struct list_s<H, T...> { using type = cons_<H, typename list_s<T...>::type>; }; template <> struct list_s<> { using type = nil_; }; template <class... T> using list_ = typename list_s<T...>::type; constexpr nil_ list () { return nil; } template <class H, class... T> constexpr list_<H, T...> list (H h, T... t) { return cons(h, list(t...)); } constexpr auto l1 = list("monkey", 123.4, cons(1, 2), nullptr); Error when compiled with g++ -std=c++11 -c gccbug.cpp: gccbug.cpp:36:63: internal compiler error: in output_constant, at varasm.c:4658 constexpr auto l1 = list("monkey", 123.4, cons(1, 2), nullptr); ^ Removing nullptr from the list, or enabling optimizations stops the error from happening. gcc -v: Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /build/gcc-multilib/src/gcc-4.8-20130725/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --disable-install-libiberty --enable-multilib --disable-libssp --disable-werror --enable-checking=release Thread model: posix gcc version 4.8.1 20130725 (prerelease) (GCC)