https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94175
Bug ID: 94175 Summary: [10 Regression] Passing constexpr empty class variable to function since r10-599 Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- Since r10-599-gc652ff83124334837dc16626f9e1040e4fe41fc9 following testcase with -O2 -m32 (or -O0 -m32 or any arch other than x86_64 64-bit): struct Foo { struct NoStartBar {}; static constexpr NoStartBar noStartBar = NoStartBar(); [[gnu::noinline, gnu::noclone]] Foo(int x, NoStartBar) : f (x) { f++; } Foo(double x) : Foo(0, noStartBar) {} int f; }; Foo a = 6.0; needs the Foo::noStartBar definition, while before it didn't and just passed NoStartBar {}. Is passing the static data member an ODR use of it or not? In any case, looks like a missed optimization, there shouldn't be reason to copy the empty class from a variable rather than just passing uninitialized bytes.