This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53794] New: [c++11, accepts invalid] dangling reference accepted in nested structures with initializer lists
- From: "dirkmoermans at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 28 Jun 2012 09:35:24 +0000
- Subject: [Bug c++/53794] New: [c++11, accepts invalid] dangling reference accepted in nested structures with initializer lists
- Auto-submitted: auto-generated
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.