This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/60223] New: [c++11] ICE with C++11-style default template parameter
- From: "reichelt at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 16 Feb 2014 17:07:25 +0000
- Subject: [Bug c++/60223] New: [c++11] ICE with C++11-style default template parameter
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60223
Bug ID: 60223
Summary: [c++11] ICE with C++11-style default template
parameter
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
The following valid code snippet (compiled with "-std=c++11") triggers
an ICE since GCC 4.6.0:
==========================================
template<typename T, T = T{}> struct A {};
template<typename T> void foo(A<T>) {}
void bar()
{
foo(A<char>());
}
==========================================
bug.cc: In substitution of 'template<class T> void foo(A<T>) [with T =
<missing>]':
bug.cc:7:16: required from here
bug.cc:7:16: internal compiler error: in unify, at cp/pt.c:17895
foo(A<char>());
^
0x635440 unify
../../gcc/gcc/cp/pt.c:17895
0x634bf6 unify
../../gcc/gcc/cp/pt.c:17717
0x5525ad try_class_unification
../../gcc/gcc/cp/pt.c:16736
0x634775 unify
../../gcc/gcc/cp/pt.c:17753
0x6374e7 unify_one_argument
../../gcc/gcc/cp/pt.c:16161
0x639944 type_unification_real
../../gcc/gcc/cp/pt.c:16233
0x64265a fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
../../gcc/gcc/cp/pt.c:15671
0x5addd1 add_template_candidate_real
../../gcc/gcc/cp/call.c:2973
0x5a9a7c add_template_candidate
../../gcc/gcc/cp/call.c:3070
0x5a9a7c add_candidates
../../gcc/gcc/cp/call.c:5131
0x5afee8 perform_overload_resolution
../../gcc/gcc/cp/call.c:3866
0x5b2bca build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
../../gcc/gcc/cp/call.c:3943
0x72e404 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2348
0x6b2571 cp_parser_postfix_expression
../../gcc/gcc/cp/parser.c:6164
0x6b5116 cp_parser_unary_expression
../../gcc/gcc/cp/parser.c:7170
0x6b5e3f cp_parser_binary_expression
../../gcc/gcc/cp/parser.c:7874
0x6b6331 cp_parser_assignment_expression
../../gcc/gcc/cp/parser.c:8112
0x6b86e4 cp_parser_expression
../../gcc/gcc/cp/parser.c:8274
0x6b8f1c cp_parser_expression
../../gcc/gcc/cp/parser.c:8313
0x6b8f1c cp_parser_expression_statement
../../gcc/gcc/cp/parser.c:9622
Please submit a full bug report, [etc.]
Before GCC 4.6.0 the code was wrongly rejected.