https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79361
Bug ID: 79361
Summary: [5/6/7 Regression] ICE redefining a template function
as defaulted or deleted
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
Target Milestone: ---
The following two invalid testcases trigger ICEs on trunk:
===========================================
template<typename T> void foo(T);
template<> void foo<int>(int) {}
template<> void foo<int>(int) = delete;
===========================================
bug.cc:4:17: error: redefinition of 'void foo(T) [with T = int]'
template<> void foo<int>(int) = delete;
^~~~~~~~
bug.cc:3:17: note: 'void foo(T) [with T = int]' previously declared here
template<> void foo<int>(int) {}
^~~~~~~~
bug.cc: In function 'void foo(T) [with T = int]':
bug.cc:3:17: internal compiler error: tree check: expected block, have
error_mark in lower_function_body, at gimple-low.c:98
0x102f4bc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/gcc/tree.c:9814
0x14904c7 tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3060
0x14904c7 lower_function_body
../../gcc/gcc/gimple-low.c:98
0x14904c7 execute
../../gcc/gcc/gimple-low.c:181
Please submit a full bug report, [etc.]
===========================================
template<typename T> void foo(T);
template<> void foo<int>(int) {}
template<> void foo<int>(int) = default;
===========================================
bug.cc:4:17: error: redefinition of 'void foo(T) [with T = int]'
template<> void foo<int>(int) = default;
^~~~~~~~
bug.cc:3:17: note: 'void foo(T) [with T = int]' previously declared here
template<> void foo<int>(int) {}
^~~~~~~~
bug.cc:4:33: error: a template cannot be defaulted
template<> void foo<int>(int) = default;
^~~~~~~
bug.cc: In function 'void foo(T) [with T = int]':
bug.cc:3:17: internal compiler error: Segmentation fault
template<> void foo<int>(int) {}
^~~~~~~~
0xd9292f crash_signal
../../gcc/gcc/toplev.c:333
0x14901ae tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3059
0x14901ae lower_function_body
../../gcc/gcc/gimple-low.c:98
0x14901ae execute
../../gcc/gcc/gimple-low.c:181
Please submit a full bug report, [etc.]
These bugs appeared in GCC 4.5.0.