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

            Bug ID: 84082
           Summary: [7/8 Regression] ICE with broken template function
                    definition
           Product: gcc
           Version: 8.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 follwong invalid code snippet triggers an ICE since GCC 7.1.0:

====================================
struct A;

template<typename> void foo()
[
  A().operator=(A());
]
====================================

bug.cc:5:3: warning: invalid use of incomplete type 'struct A'
   A().operator=(A());
   ^~~
bug.cc:1:8: note: forward declaration of 'struct A'
 struct A;
        ^
bug.cc:5:20: internal compiler error: Segmentation fault
   A().operator=(A());
                    ^
0xeab52f crash_signal
        ../../gcc/gcc/toplev.c:325
0x8555b2 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
        ../../gcc/gcc/tree.h:3245
0x8555b2 potential_constant_expression_1
        ../../gcc/gcc/cp/constexpr.c:5672
0x8560c8 potential_constant_expression_1
        ../../gcc/gcc/cp/constexpr.c:5309
0x90fc07 cp_parser_constant_expression
        ../../gcc/gcc/cp/parser.c:9736
0x9229e2 cp_parser_direct_declarator
        ../../gcc/gcc/cp/parser.c:20059
0x9229e2 cp_parser_declarator
        ../../gcc/gcc/cp/parser.c:19798
0x9312b0 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:19323
0x9386da cp_parser_single_declaration
        ../../gcc/gcc/cp/parser.c:27104
0x93881c cp_parser_template_declaration_after_parameters
        ../../gcc/gcc/cp/parser.c:26706
0x9390dc cp_parser_explicit_template_declaration
        ../../gcc/gcc/cp/parser.c:26943
0x9390dc cp_parser_template_declaration_after_export
        ../../gcc/gcc/cp/parser.c:26962
0x93e449 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:12673
0x93e731 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:12600
0x93ea24 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4559
0x93ea24 c_parse_file()
        ../../gcc/gcc/cp/parser.c:38820
0xa3cd46 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1132
Please submit a full bug report, [etc.]

Reply via email to