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 | 5fa2ef4445fa674f93fd87e6a1fc8f9582724b5c (patch) | |
tree | cf267b7cb244a2cdd92f3f4bc705e62eac634812 /clang/test/SemaCXX/lambda-expressions.cpp | |
parent | 8c69c96dc99d91cc5a391ad026f46a30b062fbed (diff) | |
download | bcm5719-llvm-5fa2ef4445fa674f93fd87e6a1fc8f9582724b5c.tar.gz bcm5719-llvm-5fa2ef4445fa674f93fd87e6a1fc8f9582724b5c.zip |
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.
llvm-svn: 152593
Diffstat (limited to 'clang/test/SemaCXX/lambda-expressions.cpp')
-rw-r--r-- | clang/test/SemaCXX/lambda-expressions.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/lambda-expressions.cpp b/clang/test/SemaCXX/lambda-expressions.cpp index 99fc0caaf7a..80ba0a1d035 100644 --- a/clang/test/SemaCXX/lambda-expressions.cpp +++ b/clang/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)}} + }; + } +} |