https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120577
Bug ID: 120577 Summary: Another crash with [[no_unique_address]] and constexpr functions 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: --- ``` template <class _Tp> struct optional { union { _Tp __val_; }; template <class... _Args> constexpr optional(_Args... __args) : __val_(__args...) {} }; template <class _Tp, class... _Args> constexpr optional<_Tp> make_optional(_Args... __args) { return optional<_Tp>(__args...); } struct __non_trivial_if { constexpr __non_trivial_if() {} }; struct allocator : __non_trivial_if {}; struct __padding {}; struct __short { [[__no_unique_address__]] __padding __padding_; int __data_; }; struct basic_string { union { __short __s; }; [[__no_unique_address__]] allocator __alloc_; constexpr basic_string(int, int) {} }; auto opt = make_optional<basic_string>(4, 'X'); ``` This is another crash similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120502. I'm pretty sure it's distinct though. I've applied the other patch locally and that fixed the bug, but this reproducer still crashes. This time `g++ -std=c++26 <file>` is enough to reproduce.