diff options
author | John McCall <rjmccall@apple.com> | 2012-03-13 00:37:01 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2012-03-13 00:37:01 +0000 |
commit | 78dae24600a877f52dbb6e58bfd5778754a00974 (patch) | |
tree | c04e7d5b386b2fd083c0dff74a2d34517e444680 /test/SemaCXX/lambda-expressions.cpp | |
parent | 8ce6d214aef65ea1421eb11e84980dfa4da429b8 (diff) |
Alternate fix to PR12248: put Sema in charge of special-casing
the diagnostic for assigning to a copied block capture. This has
the pleasant side-effect of letting us special-case the diagnostic
for assigning to a copied lambda capture as well, without introducing
a new non-modifiable enumerator for it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152593 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/lambda-expressions.cpp')
-rw-r--r-- | test/SemaCXX/lambda-expressions.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/SemaCXX/lambda-expressions.cpp b/test/SemaCXX/lambda-expressions.cpp index 99fc0caaf7..80ba0a1d03 100644 --- a/test/SemaCXX/lambda-expressions.cpp +++ b/test/SemaCXX/lambda-expressions.cpp @@ -139,3 +139,12 @@ void PR12248() unsigned int result = 0; auto l = [&]() { ++result; }; } + +namespace ModifyingCapture { + void test() { + int n = 0; + [=] { + n = 1; // expected-error {{variable is not assignable (captured by copy)}} + }; + } +} |