[Bug c++/53794] New: [c++11, accepts invalid] dangling reference accepted in nested structures with initializer lists
dirkmoermans at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jun 28 09:35:00 GMT 2012
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: unassigned@gcc.gnu.org
ReportedBy: dirkmoermans@gmail.com
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.
More information about the Gcc-bugs
mailing list