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

            Bug ID: 84752
           Summary: [8 Regression] ICE with constexpr array referenced in
                    lambda
           Product: gcc
           Version: 8.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
  Target Milestone: ---

The following valid code snippet triggers an ICE on trunk:

===============================
void foo()
{
  constexpr int x[1] = {};
  [&x]{ return (bool)x; };
}
===============================

bug.cc: In lambda function:
bug.cc:4:22: internal compiler error: in build_address, at cp/typeck.c:5744
   [&x]{ return (bool)x; };
                      ^
0x66a78b build_address(tree_node*)
        ../../gcc/gcc/tree.h:3332
0x9dcaca cp_build_addr_expr_1
        ../../gcc/gcc/cp/typeck.c:5974
0x9ddede cp_build_addr_expr(tree_node*, int)
        ../../gcc/gcc/cp/typeck.c:6020
0x9ddede decay_conversion(tree_node*, int, bool)
        ../../gcc/gcc/cp/typeck.c:2082
0x8236df convert_like_real
        ../../gcc/gcc/cp/call.c:7087
0x823045 convert_like_real
        ../../gcc/gcc/cp/call.c:6912
0x82cbe2 perform_direct_initialization_if_possible(tree_node*, tree_node*,
bool, int)
        ../../gcc/gcc/cp/call.c:10665
0x9e3b36 build_static_cast_1
        ../../gcc/gcc/cp/typeck.c:7035
0x9e7dc7 cp_build_c_cast(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/typeck.c:7796
0x9e807a build_c_cast(unsigned int, tree_node*, cp_expr)
        ../../gcc/gcc/cp/typeck.c:7704
0x915d21 cp_parser_cast_expression
        ../../gcc/gcc/cp/parser.c:9079
0x91628a cp_parser_binary_expression
        ../../gcc/gcc/cp/parser.c:9191
0x917ac4 cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:9486
0x9181d8 cp_parser_expression
        ../../gcc/gcc/cp/parser.c:9655
0x920a26 cp_parser_jump_statement
        ../../gcc/gcc/cp/parser.c:12415
0x920a26 cp_parser_statement
        ../../gcc/gcc/cp/parser.c:10829
0x9217f0 cp_parser_statement_seq_opt
        ../../gcc/gcc/cp/parser.c:11274
0x9222c7 cp_parser_lambda_body
        ../../gcc/gcc/cp/parser.c:10685
0x9222c7 cp_parser_lambda_expression
        ../../gcc/gcc/cp/parser.c:10186
0x9222c7 cp_parser_primary_expression
        ../../gcc/gcc/cp/parser.c:5261
Please submit a full bug report, [etc.]

The regression was introduced between 2017-09-26 and 2017-10-07.

Reply via email to