[Bug c++/105244] New: [9/10/11/12 Regression] ICE in implicitly_declare_fn, at cp/method.cc:3114

gscfq@t-online.de gcc-bugzilla@gcc.gnu.org
Tue Apr 12 17:24:38 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105244

            Bug ID: 105244
           Summary: [9/10/11/12 Regression] ICE in implicitly_declare_fn,
                    at cp/method.cc:3114
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started between 20190217 and 20190224,
with option -std=c++98 or -std=c++03 :


$ cat z1.cc
template <class T>
struct S
{
  static T max();
};
template <class A = double>
struct V
{
  double a = S<double>::max[1]();
};
template <class T>
V<> foo()
{
  return {};
}
int main()
{
  V<> b = foo<double>();
}


$ g++-12-20220410 -c z1.cc -std=c++03
z1.cc:9:12: warning: non-static data member initializers only available with
'-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
    9 |   double a = S<double>::max[1]();
      |            ^
z1.cc: In function 'V<> foo()':
z1.cc:14:10: warning: extended initializer lists only available with
'-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   14 |   return {};
      |          ^
z1.cc:9:30: warning: pointer to a function used in arithmetic [-Wpointer-arith]
    9 |   double a = S<double>::max[1]();
      |              ~~~~~~~~~~~~~~~~^
z1.cc:14:11: internal compiler error: in implicitly_declare_fn, at
cp/method.cc:3114
   14 |   return {};
      |           ^
0x792b1d implicitly_declare_fn(special_function_kind, tree_node*, bool,
tree_node*, tree_node*)
        ../../gcc/cp/method.cc:3114
0x792f5c lazily_declare_fn(special_function_kind, tree_node*)
        ../../gcc/cp/method.cc:3415
0x7c347c maybe_lazily_declare
        ../../gcc/cp/name-lookup.cc:1896
0x7c347c get_class_binding(tree_node*, tree_node*, bool)
        ../../gcc/cp/name-lookup.cc:1926
0x6dc612 build_user_type_conversion_1
        ../../gcc/cp/call.cc:4151
0x6d54e1 implicit_conversion_1
        ../../gcc/cp/call.cc:2091
0x6d54e1 implicit_conversion
        ../../gcc/cp/call.cc:2132
0x6da2ce perform_implicit_conversion_flags(tree_node*, tree_node*, int, int)
        ../../gcc/cp/call.cc:12710
0x898699 convert_for_initialization(tree_node*, tree_node*, tree_node*, int,
impl_conv_rhs, tree_node*, int, int)
        ../../gcc/cp/typeck.cc:10067
0x8992fe check_return_expr(tree_node*, bool*)
        ../../gcc/cp/typeck.cc:10729
0x85d31e finish_return_stmt(tree_node*)
        ../../gcc/cp/semantics.cc:1195
0x7f3d17 cp_parser_jump_statement
        ../../gcc/cp/parser.cc:14307
0x7f3d17 cp_parser_statement
        ../../gcc/cp/parser.cc:12312
0x7f42f4 cp_parser_statement_seq_opt
        ../../gcc/cp/parser.cc:12850
0x7f43af cp_parser_compound_statement
        ../../gcc/cp/parser.cc:12802
0x812578 cp_parser_function_body
        ../../gcc/cp/parser.cc:25060
0x812578 cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/cp/parser.cc:25111
0x812a36 cp_parser_function_definition_after_declarator
        ../../gcc/cp/parser.cc:31242
0x813987 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/cp/parser.cc:31158
0x813987 cp_parser_init_declarator
        ../../gcc/cp/parser.cc:22582


More information about the Gcc-bugs mailing list