diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-01-10 01:28:13 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-01-10 01:28:13 +0000 |
commit | 22c634704f7f4a0803f08bebd1e1bc662f5ab77f (patch) | |
tree | 5b845a11d8a9348008970a3f4646293f00593b7a /lib/Sema | |
parent | afe88a16c63ece9ce3715c3acbbabd83a488921f (diff) |
Fix temporary lifetime extension from an initializer using braced "functional"
cast notation T{...} when T is a reference type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225571 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaInit.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index b57e029ddf..569ef30747 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -5497,18 +5497,18 @@ static void performLifetimeExtension(Expr *Init, static bool performReferenceExtension(Expr *Init, const InitializedEntity *ExtendingEntity) { - if (InitListExpr *ILE = dyn_cast<InitListExpr>(Init)) { - if (ILE->getNumInits() == 1 && ILE->isGLValue()) { - // This is just redundant braces around an initializer. Step over it. - Init = ILE->getInit(0); - } - } - // Walk past any constructs which we can lifetime-extend across. Expr *Old; do { Old = Init; + if (InitListExpr *ILE = dyn_cast<InitListExpr>(Init)) { + if (ILE->getNumInits() == 1 && ILE->isGLValue()) { + // This is just redundant braces around an initializer. Step over it. + Init = ILE->getInit(0); + } + } + // Step over any subobject adjustments; we may have a materialized // temporary inside them. SmallVector<const Expr *, 2> CommaLHSs; |