summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-01-10 01:28:13 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-01-10 01:28:13 +0000
commitdbc82492248a72fafa40e3ecfd48b28a271d7b99 (patch)
tree7d0e15b38a288d6ef03bf7355bd67031bf1e9a5b /clang/lib/Sema/SemaInit.cpp
parent43a0f99b103dc9c2546e650b99f5501e49e74dd2 (diff)
downloadbcm5719-llvm-dbc82492248a72fafa40e3ecfd48b28a271d7b99.tar.gz
bcm5719-llvm-dbc82492248a72fafa40e3ecfd48b28a271d7b99.zip
Fix temporary lifetime extension from an initializer using braced "functional"
cast notation T{...} when T is a reference type. llvm-svn: 225571
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index b57e029ddfd..569ef307474 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud