summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-05-25 01:04:17 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-05-25 01:04:17 +0000
commit0353e5a6cdc8df518ab0cfebcc0b92747265a55e (patch)
tree152b6b7e940174a1b0e3b836c39f7200ab5d84cf /clang/lib/Sema/SemaExpr.cpp
parenta846427ad0ac94506661a65f9949c627011a73a4 (diff)
downloadbcm5719-llvm-0353e5a6cdc8df518ab0cfebcc0b92747265a55e.tar.gz
bcm5719-llvm-0353e5a6cdc8df518ab0cfebcc0b92747265a55e.zip
Permit static local structured bindings to be named from arbitrary scopes inside their declaring scope.
llvm-svn: 361686
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 0c04f03f06d..3a12c2dd84f 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -3059,9 +3059,11 @@ ExprResult Sema::BuildDeclarationNameExpr(
// FIXME: Support lambda-capture of BindingDecls, once CWG actually
// decides how that's supposed to work.
auto *BD = cast<BindingDecl>(VD);
- if (BD->getDeclContext()->isFunctionOrMethod() &&
- BD->getDeclContext() != CurContext)
- diagnoseUncapturableValueReference(*this, Loc, BD, CurContext);
+ if (BD->getDeclContext() != CurContext) {
+ auto *DD = dyn_cast_or_null<VarDecl>(BD->getDecomposedDecl());
+ if (DD && DD->hasLocalStorage())
+ diagnoseUncapturableValueReference(*this, Loc, BD, CurContext);
+ }
break;
}
OpenPOWER on IntegriCloud