PR16502: Fix a dumb bug where we might look past the last initializer in an

InitListExpr.

llvm-svn: 185304
This commit is contained in:
Richard Smith 2013-07-01 06:08:20 +00:00
parent 69665e112b
commit 0bca59d6f7
2 changed files with 8 additions and 0 deletions

View File

@ -5346,6 +5346,8 @@ static void performLifetimeExtension(Expr *Init, const ValueDecl *ExtendingD) {
for (RecordDecl::field_iterator I = RD->field_begin(),
E = RD->field_end();
I != E; ++I) {
if (Index >= ILE->getNumInits())
break;
if (I->isUnnamedBitfield())
continue;
Expr *SubInit = ILE->getInit(Index);

View File

@ -30,3 +30,9 @@ PR6139 x = {{A()}}; // expected-error{{non-const lvalue reference to type 'A [1]
struct PR6139b { A (&x)[1]; };
PR6139b y = {A()}; // expected-error{{non-const lvalue reference to type 'A [1]' cannot bind to a temporary of type 'A'}}
namespace PR16502 {
struct A { int &&temporary; int x, y; };
int f();
const A &c = { 10, ++c.temporary };
}