mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 03:26:06 +00:00
PR16502: Fix a dumb bug where we might look past the last initializer in an
InitListExpr. llvm-svn: 185304
This commit is contained in:
parent
69665e112b
commit
0bca59d6f7
@ -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);
|
||||
|
@ -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 };
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user