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

            Bug ID: 84664
           Summary: internal compiler error: in
                    cp_perform_integral_promotions, at cp/typeck.c:2172
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vegard.nossum at gmail dot com
                CC: webrown.cpp at gmail dot com
  Target Milestone: ---

Input:

int a() {
  auto &b = 1;
  [] { b > 0 }
}

Output:

$ xgcc -x c++ -S -
<stdin>: In function 'int a()':
<stdin>:2:13: error: cannot bind non-const lvalue reference of type 'int&' to
an rvalue of type 'int'
<stdin>: In lambda function:
<stdin>:3:12: error: 'b' is not captured
<stdin>:3:4: note: the lambda has no capture-default
<stdin>:2:9: note: 'int& b' declared here
<stdin>:3:12: internal compiler error: in cp_perform_integral_promotions, at
cp/typeck.c:2172
0x13afaff cp_perform_integral_promotions(tree_node*, int)
        /home/vegard/git/gcc/gcc/cp/typeck.c:2172
0x13cc321 cp_default_conversion
        /home/vegard/git/gcc/gcc/cp/typeck.c:2138
0x13cc5d7 cp_build_binary_op(unsigned int, tree_code, tree_node*, tree_node*,
int)
        /home/vegard/git/gcc/gcc/cp/typeck.c:4270
0x945247 build_new_op_1
        /home/vegard/git/gcc/gcc/cp/call.c:6013
0x948c36 build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*,
tree_node*, tree_node**, int)
        /home/vegard/git/gcc/gcc/cp/call.c:6058
0x1395e6b build_x_binary_op(unsigned int, tree_code, tree_node*, tree_code,
tree_node*, tree_code, tree_node**, int)
        /home/vegard/git/gcc/gcc/cp/typeck.c:4030
0xec7b2b cp_parser_binary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9354
0xec95aa cp_parser_assignment_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9484
0xecd516 cp_parser_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9653
0xee1a96 cp_parser_expression_statement
        /home/vegard/git/gcc/gcc/cp/parser.c:11129
0xefd340 cp_parser_statement
        /home/vegard/git/gcc/gcc/cp/parser.c:10933
0xf0184b cp_parser_statement_seq_opt
        /home/vegard/git/gcc/gcc/cp/parser.c:11272
0xfd36d1 cp_parser_lambda_body
        /home/vegard/git/gcc/gcc/cp/parser.c:10683
0xfd36d1 cp_parser_lambda_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:10184
0xf38814 cp_parser_primary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:5259
0xf7a2eb cp_parser_postfix_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:7028
0xf2e057 cp_parser_unary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:8320
0xec31aa cp_parser_cast_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9088
0xec57d6 cp_parser_binary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9189
0xec95aa cp_parser_assignment_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9484

$ xgcc --version
xgcc (GCC) 8.0.1 20180301 (experimental)

Built from git c435a9e730c6e8f10da09d58b4fc9aaeb401b0d5 (r258097).

7.3.0 looks fine to me.

Test case was minimised by C-Reduce.

Reply via email to