public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58582] New: [c++11] ICE defining and instantiating deleted template function
@ 2013-09-30 20:02 reichelt at gcc dot gnu.org
2014-04-29 17:24 ` [Bug c++/58582] " paolo.carlini at oracle dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-09-30 20:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58582
Bug ID: 58582
Summary: [c++11] ICE defining and instantiating deleted
template function
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
The following invalid code snippet (compiled with "-std=c++0x") triggers an ICE
since GCC 4.4.0 (when deleted functions were introduced):
========================================
struct A
{
template<int> void foo() = delete;
};
template<int> void A::foo() { int i; }
template void A::foo<0>();
========================================
bug.cc:6:20: error: redefinition of 'void A::foo()'
template<int> void A::foo() { int i; }
^
bug.cc:3:22: note: 'void A::foo()' previously declared here
template<int> void foo() = delete;
^
bug.cc: In instantiation of 'void A::foo() [with int <anonymous> = 0]':
bug.cc:8:25: required from here
bug.cc:6:36: internal compiler error: in add_stmt, at cp/semantics.c:386
template<int> void A::foo() { int i; }
^
0x6ae530 add_stmt(tree_node*)
../../gcc/gcc/cp/semantics.c:386
0x5a43ac tsubst_expr
../../gcc/gcc/cp/pt.c:13289
0x5a1cdf instantiate_decl(tree_node*, int, bool)
../../gcc/gcc/cp/pt.c:19391
0x5de5ff instantiate_pending_templates(int)
../../gcc/gcc/cp/pt.c:19492
0x619766 cp_write_global_declarations()
../../gcc/gcc/cp/decl2.c:4060
Please submit a full bug report, [etc.]
A slightly modified example (just leave out "int i;") crashes in a different
place:
========================================
struct A
{
template<int> void foo() = delete;
};
template<int> void A::foo() {}
template void A::foo<0>();
========================================
bug.cc:6:20: error: redefinition of 'void A::foo()'
template<int> void A::foo() {}
^
bug.cc:3:22: note: 'void A::foo()' previously declared here
template<int> void foo() = delete;
^
bug.cc: In instantiation of 'void A::foo() [with int <anonymous> = 0]':
bug.cc:8:25: required from here
bug.cc:6:30: internal compiler error: in finish_function, at cp/decl.c:13810
template<int> void A::foo() {}
^
0x56ab15 finish_function(int)
../../gcc/gcc/cp/decl.c:13810
0x5a1d18 instantiate_decl(tree_node*, int, bool)
../../gcc/gcc/cp/pt.c:19402
0x5de5ff instantiate_pending_templates(int)
../../gcc/gcc/cp/pt.c:19492
0x619766 cp_write_global_declarations()
../../gcc/gcc/cp/decl2.c:4060
Please submit a full bug report, [etc.]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-05-03 22:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-30 20:02 [Bug c++/58582] New: [c++11] ICE defining and instantiating deleted template function reichelt at gcc dot gnu.org
2014-04-29 17:24 ` [Bug c++/58582] " paolo.carlini at oracle dot com
2014-05-03 22:45 ` paolo at gcc dot gnu.org
2014-05-03 22:46 ` paolo.carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).