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

            Bug ID: 123663
           Summary: [16 Regression] ICE: segmentation fault in
                    build_vec_init when evaluating concept with array new
                    of local struct
           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/9jMderdMo
The following c++ code crash gcc trunk with -std=c++23 flag.
But 13,14,15 with checking accept this code without error.


Code:
```cpp
template <typename T>
concept TestConcept = requires {
  new T[1]{};
};
struct base {
  base() {
    struct Foo {};
    TestConcept<Foo>;
  }
};
```

Stack dump:
```
<source>:3:3: internal compiler error: Segmentation fault
    3 |   new T[1]{};
      |   ^~~~~~~~~~
0x2950a78 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x294583b internal_error(char const*, ...)
        ???:0
0xc5ce3a build_vec_init(tree_node*, tree_node*, tree_node*, bool, int, int,
vec<tree_node*, va_gc, vl_embed>**)
        ???:0
0xc62760 build_new(unsigned long, vec<tree_node*, va_gc, vl_embed>**,
tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int, int)
        ???:0
0xbb1316 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xbb2821 evaluate_concept_check(tree_node*)
        ???:0
0xbd8ab8 convert_to_void(tree_node*, impl_conv_void, int)
        ???:0
0xdfbbce finish_expr_stmt(tree_node*)
        ???:0
0xd64c03 c_parse_file()
        ???:0
0xeeed49 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