https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81057
Bug ID: 81057 Summary: [5/6/7/8 Regression] ICE with broken default template parameter Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org Target Milestone: --- The following invalid code snippet (compiled with -std=c++11) triggers an ICE since GCC 5.1.0: ====================================================== struct A { constexpr operator bool() const { return true; } }; template<bool> struct B {}; template<typename = B<A{x}>> void foo() {} ====================================================== bug.cc:8:25: error: 'x' was not declared in this scope template<typename = B<A{x}>> void foo() {} ^ bug.cc:8:26: internal compiler error: in build_address, at cp/typeck.c:5619 template<typename = B<A{x}>> void foo() {} ^ 0x83ef77 build_address(tree_node*) ../../gcc/gcc/cp/typeck.c:5619 0x60b787 add_function_candidate ../../gcc/gcc/cp/call.c:2164 0x60d1f7 add_candidates ../../gcc/gcc/cp/call.c:5480 0x6082ab add_candidates ../../gcc/gcc/cp/call.c:3844 0x6082ab build_user_type_conversion_1 ../../gcc/gcc/cp/call.c:3845 0x609c98 implicit_conversion ../../gcc/gcc/cp/call.c:1898 0x60f702 build_integral_nontype_arg_conv(tree_node*, tree_node*, int) ../../gcc/gcc/cp/call.c:4029 0x7c536c convert_nontype_argument ../../gcc/gcc/cp/pt.c:6579 0x7c536c convert_template_argument ../../gcc/gcc/cp/pt.c:7740 0x7c6433 coerce_template_parms ../../gcc/gcc/cp/pt.c:8198 0x7cbb6a lookup_template_class_1 ../../gcc/gcc/cp/pt.c:8734 0x7cbb6a lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*, int, int) ../../gcc/gcc/cp/pt.c:9079 0x80126d finish_template_type(tree_node*, tree_node*, int) ../../gcc/gcc/cp/semantics.c:3185 0x74cf14 cp_parser_template_id ../../gcc/gcc/cp/parser.c:15518 0x74d12f cp_parser_class_name ../../gcc/gcc/cp/parser.c:21966 0x760432 cp_parser_qualifying_entity ../../gcc/gcc/cp/parser.c:6289 0x760432 cp_parser_nested_name_specifier_opt ../../gcc/gcc/cp/parser.c:5975 0x76391a cp_parser_simple_type_specifier ../../gcc/gcc/cp/parser.c:16852 0x755bed cp_parser_type_specifier ../../gcc/gcc/cp/parser.c:16525 0x756b32 cp_parser_type_specifier_seq ../../gcc/gcc/cp/parser.c:20794 Please submit a full bug report, [etc.]