diff options
| author | Mike Stump <mrs@apple.com> | 2010-01-05 02:56:35 +0000 |
|---|---|---|
| committer | Mike Stump <mrs@apple.com> | 2010-01-05 02:56:35 +0000 |
| commit | 7dafa0d0481049cf71501d3cf36b6785b78a4e31 (patch) | |
| tree | dc1abb2211ad706c49d9a17972f45bd24e51087b /clang/lib | |
| parent | acd71a456254f3b4b1f9a860ab09f93026b1e0ef (diff) | |
| download | bcm5719-llvm-7dafa0d0481049cf71501d3cf36b6785b78a4e31.tar.gz bcm5719-llvm-7dafa0d0481049cf71501d3cf36b6785b78a4e31.zip | |
Disallow capturing vlas inside blocks.
llvm-svn: 92676
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index d291cbb394a..f0d39dde9f4 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1531,6 +1531,12 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS, // as they do not get snapshotted. // if (CurBlock && ShouldSnapshotBlockValueReference(CurBlock, VD)) { + if (VD->getType().getTypePtr()->isVariablyModifiedType()) { + Diag(Loc, diag::err_ref_vm_type); + Diag(D->getLocation(), diag::note_declared_at); + return ExprError(); + } + MarkDeclarationReferenced(Loc, VD); QualType ExprTy = VD->getType().getNonReferenceType(); // The BlocksAttr indicates the variable is bound by-reference. |

