With -std=c++11, using bracketed initialisation on a pointer to member function inside a templated class crashes GCC with an ICE segfault: fx:~/src/wikiwordfreq% LC_MESSAGES=C g++ -std=c++11 bug.cpp bug.cpp: In instantiation of ‘c<T>::c() [with T = int]’: bug.cpp:14:23: required from here bug.cpp:7:22: internal compiler error: Segmentation fault auto x = m{&c::mf}; ^
Created attachment 33684 [details] bug.cpp g++ -std=c++11 bug.cpp
The ICE also occurs in gcc HEAD 5.0.0 20141010 (experimental): <quote> prog.cc: In instantiation of 'c<T>::c() [with T = int]': prog.cc:14:23: required from here prog.cc:7:22: internal compiler error: Segmentation fault auto x = m{&c::mf}; ^ 0x9af2bf crash_signal /home/heads/gcc/gcc-source/gcc/toplev.c:340 0x55be89 extend_ref_init_temps(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**) /home/heads/gcc/gcc-source/gcc/cp/call.c:9710 0x55befb extend_ref_init_temps(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**) /home/heads/gcc/gcc-source/gcc/cp/call.c:9732 0x5aaa15 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) /home/heads/gcc/gcc-source/gcc/cp/typeck2.c:792 0x56f0a5 check_initializer /home/heads/gcc/gcc-source/gcc/cp/decl.c:5892 0x580e9c cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) /home/heads/gcc/gcc-source/gcc/cp/decl.c:6517 0x59071e tsubst_expr /home/heads/gcc/gcc-source/gcc/cp/pt.c:13788 0x58fe05 tsubst_expr /home/heads/gcc/gcc-source/gcc/cp/pt.c:13862 0x58f6e4 tsubst_expr /home/heads/gcc/gcc-source/gcc/cp/pt.c:13676 0x58fe05 tsubst_expr /home/heads/gcc/gcc-source/gcc/cp/pt.c:13862 0x58ea74 instantiate_decl(tree_node*, int, bool) /home/heads/gcc/gcc-source/gcc/cp/pt.c:20241 0x5a813b instantiate_pending_templates(int) /home/heads/gcc/gcc-source/gcc/cp/pt.c:20357 0x5c14d8 cp_write_global_declarations() /home/heads/gcc/gcc-source/gcc/cp/decl2.c:4367 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. </quote>
Even 4.7 ICEs.
Author: paolo Date: Wed Mar 13 15:01:00 2019 New Revision: 269651 URL: https://gcc.gnu.org/viewcvs?rev=269651&root=gcc&view=rev Log: 2019-03-13 Paolo Carlini <paolo.carlini@oracle.com> PR c++/63508 * g++.dg/cpp0x/auto53.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp0x/auto53.C Modified: trunk/gcc/testsuite/ChangeLog
Fixed in 8.1.0.