https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120135
Bug ID: 120135
Summary: Strange -Wunitialized behavior with struct
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: andrew.bell.ia at gmail dot com
Target Milestone: ---
The following code (Goldbolt) reports a warning with -Wuninitialized despite
the fact that an explicit constructor has been called. Strangely, this only
happens if the structure is an aggregate. If the structure only contains a
single member, no warning is emitted.
I would think that invoking an explicit constructor would eliminate any
-Wuninitialized warnings and I would at least expect it to work consistently.
https://godbolt.org/z/1G46r7785
This behavior seems to exist from 13.1 -> current trunk.