Bug 63508 - ICE when using bracketed initializer on pointer to member function of a templated class
Summary: ICE when using bracketed initializer on pointer to member function of a templ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.1
: P3 normal
Target Milestone: 8.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-10 23:25 UTC by Mario Lang
Modified: 2019-03-13 15:02 UTC (History)
1 user (show)

See Also:
Host:
Target: x86_64-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-10-16 00:00:00


Attachments
bug.cpp (172 bytes, text/plain)
2014-10-10 23:33 UTC, Mario Lang
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Lang 2014-10-10 23:25:57 UTC
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};
                      ^
Comment 1 Mario Lang 2014-10-10 23:33:17 UTC
Created attachment 33684 [details]
bug.cpp

g++ -std=c++11 bug.cpp
Comment 2 Daniel Krügler 2014-10-11 10:03:37 UTC
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>
Comment 3 Marek Polacek 2014-10-16 12:59:03 UTC
Even 4.7 ICEs.
Comment 4 paolo@gcc.gnu.org 2019-03-13 15:01:32 UTC
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
Comment 5 Paolo Carlini 2019-03-13 15:02:17 UTC
Fixed in 8.1.0.