https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120502
Bug ID: 120502
Summary: GCC Crash at cp/constexpr.cc:5462 when trying to
constant evaluate constructor
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nikolasklauser at berlin dot de
Target Milestone: ---
```
struct non_trivial_if {
constexpr non_trivial_if() {}
};
struct allocator : non_trivial_if {};
struct padding {};
struct __short {
[[no_unique_address]] padding p;
};
struct basic_string {
union {
__short s;
int l;
};
[[no_unique_address]] allocator a;
constexpr basic_string() {}
~basic_string();
};
struct time_zone {
basic_string __abbrev;
long __offset;
};
time_zone convert_to_time_zone() { return {}; }
```
The code above crashes GCC when compiling with `-std=c++23 -O1` (Godbolt:
https://godbolt.org/z/xnEx8E7nc). This is a reduced test-case from libc++.