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

            Bug ID: 96553
           Summary: ICE in unexpected expression ‘__alignof__ (auto:1)’ of
                    kind alignof_expr
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Hi, all.

This code, reduced by C-Vise, makes GCC-trunk ICE and released versions
"confused by earlier errors, bailing out".

Input:
//small.cc
class Test{
    Test &operator || ( alignas (auto) enum{});
};

Command:
g++ small.cc

Output:
small.cc:2:34: warning: use of ‘auto’ in parameter declaration only available
with ‘-fconcepts-ts’
    2 |     Test &operator || ( alignas (auto) enum{});
      |                                  ^~~~
small.cc:2:40: error: types may not be defined in parameter types
    2 |     Test &operator || ( alignas (auto) enum{});
      |                                        ^~~~
small.cc:2:45: internal compiler error: unexpected expression ‘__alignof__
(auto:1)’ of kind alignof_expr
    2 |     Test &operator || ( alignas (auto) enum{});
      |                                             ^
0x8e014c cxx_eval_constant_expression
        ../../gcc/cp/constexpr.c:6567
0x8e068f cxx_eval_outermost_constant_expr
        ../../gcc/cp/constexpr.c:6772
0x8e4aab maybe_constant_value(tree_node*, tree_node*, bool)
        ../../gcc/cp/constexpr.c:7045
0x95075b cp_check_const_attributes(tree_node*)
        ../../gcc/cp/decl2.c:1428
0x955b72 cp_check_const_attributes(tree_node*)
        ../../gcc/cp/decl2.c:1416
0x955b72 cplus_decl_attributes(tree_node**, tree_node*, int)
        ../../gcc/cp/decl2.c:1584
0x9f27a4 cp_parser_parameter_declaration_list
        ../../gcc/cp/parser.c:22725
0x9f2b21 cp_parser_parameter_declaration_clause
        ../../gcc/cp/parser.c:22622
0x9df4f1 cp_parser_direct_declarator
        ../../gcc/cp/parser.c:21299
0x9df4f1 cp_parser_declarator
        ../../gcc/cp/parser.c:21163
0x9df045 cp_parser_declarator
        ../../gcc/cp/parser.c:21141
0x9fe4ce cp_parser_member_declaration
        ../../gcc/cp/parser.c:25291
0x9d0ea8 cp_parser_member_specification_opt
        ../../gcc/cp/parser.c:24904
0x9d0ea8 cp_parser_class_specifier_1
        ../../gcc/cp/parser.c:24001
0x9d3143 cp_parser_class_specifier
        ../../gcc/cp/parser.c:24308
0x9d3143 cp_parser_type_specifier
        ../../gcc/cp/parser.c:17811
0x9d40be cp_parser_decl_specifier_seq
        ../../gcc/cp/parser.c:14436
0x9d4e71 cp_parser_simple_declaration
        ../../gcc/cp/parser.c:13690
0xa002fe cp_parser_declaration
        ../../gcc/cp/parser.c:13510
0xa009db cp_parser_translation_unit
        ../../gcc/cp/parser.c:4793
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

My GCC version is updated on 2020-08-08.

Thanks,
Haoxin

Reply via email to