aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2012-07-11 22:50:15 +0000
committerNico Weber <nicolasweber@gmx.de>2012-07-11 22:50:15 +0000
commit8951067a2bc35fb2a535bc18432cb2d02a762b73 (patch)
treec2c68ef12f8fbbc5769acfa143961f48a59633a3 /lib/Sema/SemaStmt.cpp
parente3f470a718ec00eb8b546e405fa59bc2df2d7c46 (diff)
Don't try to do RVO on block variables that refer to an enclosing local.
Fixes PR13314, clang crashing on blocks refering to an enclosing local when the enclosing function returns void. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160089 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r--lib/Sema/SemaStmt.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 9be1d34dae..54ec58af41 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -2035,7 +2035,7 @@ const VarDecl *Sema::getCopyElisionCandidate(QualType ReturnType,
// ... the expression is the name of a non-volatile automatic object
// (other than a function or catch-clause parameter)) ...
const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(E->IgnoreParens());
- if (!DR)
+ if (!DR || DR->refersToEnclosingLocal())
return 0;
const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl());
if (!VD)