http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53794
Bug #: 53794
Summary: [c++11, accepts invalid] dangling reference accepted
in nested structures with initializer lists
Classification: Unclassified
Product: gcc
Version: 4.6.3
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
The code below is currently accepted without warning by gcc-4.6.3 and
gcc-4.7.0.
===
struct A
{
int& i;
};
struct B
{
A a;
};
int main()
{
B b1{}; // BUG: accepts invalid
// B b2; // rejected
};
===
I think it should be rejected, since uninitialized references are not allowed
by the language.