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

            Bug ID: 123551
           Summary: [16 Regression] ICE in
                    potential_constant_expression_1, at
                    cp/constexpr.cc:12523
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jirehguo at tju dot edu.cn
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/6do5fdaPz
The following valid c++ code crash gcc trunk.
But gcc 13,14,15 with checking is fine.

Code:
```cpp
auto&& expected = [](const auto&... vs) {
    goto *0;
};
```

Stack dump:
```
<source>: In lambda function:
<source>:2:11: internal compiler error: tree check: expected tree that contains
'decl common' structure, have 'non_lvalue_expr' in
potential_constant_expression_1, at cp/constexpr.cc:12523
    2 |     goto *0;
      |           ^
0x2926688 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x291b44b internal_error(char const*, ...)
        ???:0
0xa1b84e tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ???:0
0xb541a5 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
        ???:0
0xb98b7a potential_constant_expression(tree_node*)
        ???:0
0xc14141 finish_function(bool)
        ???:0
0xc63032 finish_lambda_function(tree_node*)
        ???:0
0xd57563 c_parse_file()
        ???:0
0xec8ee9 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```

Reply via email to