[Bug c++/123346] Segmentation fault when returning union initialized using temporary object at call site, with designated initializers
janschultke at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Tue Dec 30 14:40:02 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123346
--- Comment #1 from Jan Schultke <janschultke at googlemail dot com> ---
Replacing the make function with
constexpr Union make(Union&& other) {
Union result { .unit = other.unit };
return result;
}
... seems to work around the issue, so it's in some way related to
initialization of the result object via prvalue in a return statement.
More information about the Gcc-bugs
mailing list