diff options
author | Nico Weber <nicolasweber@gmx.de> | 2012-07-11 22:50:15 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2012-07-11 22:50:15 +0000 |
commit | 1325384b32b51920e1b1acd854474d52e82d5825 (patch) | |
tree | 734cf6ae11d15caf0614ac1ac06e4497dc73b0e5 /clang/lib | |
parent | ded9c2ee92f6d9b65ed211070c0c34119bd30969 (diff) | |
download | bcm5719-llvm-1325384b32b51920e1b1acd854474d52e82d5825.tar.gz bcm5719-llvm-1325384b32b51920e1b1acd854474d52e82d5825.zip |
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.
llvm-svn: 160089
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 9be1d34dae7..54ec58af419 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/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) |