https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71350
Bug ID: 71350 Summary: internal compiler error on trailing return type declaration with initializer list Product: gcc Version: 4.9.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: joostvanzwieten at gmail dot com Target Milestone: --- Created attachment 38601 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38601&action=edit minimal example producing the internal compiler error A student of mine stumbled upon an internal compiler error related to a trailing return type declaration containing an initializer list. I've attached a minimal example producing the error with Debian's versions 4.9.3-14, 5.3.1-21, 6.1.1-4 and 7.0 (revision 236009, package gcc-snapshot), all from Debian Sid, with the flag `-std=c++11`. Note that the example should not compile due to the incorrect return value in method `Foo::bar`. The output of `g++-6 -v -std=c++11 -save-temps bug.cc` follows. Best, Joost Using built-in specs. COLLECT_GCC=g++-6 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 6.1.1-4' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 6.1.1 20160519 (Debian 6.1.1-4) COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-save-temps' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-linux-gnu/6/cc1plus -E -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE bug.cc -mtune=generic -march=x86-64 -std=c++11 -fpch-preprocess -o bug.ii ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/6" ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/6/../../../../x86_64-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/include/c++/6 /usr/include/x86_64-linux-gnu/c++/6 /usr/include/c++/6/backward /usr/lib/gcc/x86_64-linux-gnu/6/include /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/6/include-fixed /usr/include/x86_64-linux-gnu /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-save-temps' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-linux-gnu/6/cc1plus -fpreprocessed bug.ii -quiet -dumpbase bug.cc -mtune=generic -march=x86-64 -auxbase bug -std=c++11 -version -o bug.s GNU C++11 (Debian 6.1.1-4) version 6.1.1 20160519 (x86_64-linux-gnu) compiled by GNU C version 6.1.1 20160519, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version 0.15 warning: MPFR header version 3.1.4 differs from library version 3.1.4-p2. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++11 (Debian 6.1.1-4) version 6.1.1 20160519 (x86_64-linux-gnu) compiled by GNU C version 6.1.1 20160519, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version 0.15 warning: MPFR header version 3.1.4 differs from library version 3.1.4-p2. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 1edfa0d359b2ee208224c72d1e98c75a ' Internal compiler error: Error reporting routines re-entered. 0x5e042b reshape_init_r ../../src/gcc/cp/decl.c:5896 0x5e0644 reshape_init_class ../../src/gcc/cp/decl.c:5673 0x5e0644 reshape_init_r ../../src/gcc/cp/decl.c:5901 0x5dfe7d reshape_init(tree_node*, tree_node*, int) ../../src/gcc/cp/decl.c:5945 0x5d2a55 implicit_conversion ../../src/gcc/cp/call.c:1795 0x5d36db reference_binding ../../src/gcc/cp/call.c:1525 0x5d286c implicit_conversion ../../src/gcc/cp/call.c:1802 0x5d3f48 add_function_candidate ../../src/gcc/cp/call.c:2121 0x5d4bef add_candidates ../../src/gcc/cp/call.c:5354 0x5daa6f build_new_op_1 ../../src/gcc/cp/call.c:5491 0x5daf5e build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*, tree_node*, tree_node**, int) ../../src/gcc/cp/call.c:5827 0x6814f5 build_x_array_ref(unsigned int, tree_node*, tree_node*, int) ../../src/gcc/cp/typeck.c:3918 0x60be66 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../src/gcc/cp/pt.c:16210 0x60ce58 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../src/gcc/cp/pt.c:16177 0x60e8d9 tsubst(tree_node*, tree_node*, int, tree_node*) ../../src/gcc/cp/pt.c:13527 0x642870 dump_template_bindings ../../src/gcc/cp/error.c:349 0x642870 dump_substitution ../../src/gcc/cp/error.c:1450 0x6482e4 decl_to_string ../../src/gcc/cp/error.c:2955 0x6482e4 cp_printer ../../src/gcc/cp/error.c:3535 0x112bfec pp_format(pretty_printer*, text_info*) ../../src/gcc/pretty-print.c:631 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.