diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-04-13 04:31:48 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-04-13 04:31:48 +0000 |
commit | 9e2f0a4f628b2cefb9a234c3c66f820bdbc966fc (patch) | |
tree | 243b31598db83cc659cf606531530741e4836db4 /clang/test/Parser/cxx0x-lambda-expressions.cpp | |
parent | 0563ca1be808a14863d87f3c878c30555328b0bf (diff) | |
download | bcm5719-llvm-9e2f0a4f628b2cefb9a234c3c66f820bdbc966fc.tar.gz bcm5719-llvm-9e2f0a4f628b2cefb9a234c3c66f820bdbc966fc.zip |
PR19339: Disambiguate lambdas with init-captures from designated initializers
properly.
llvm-svn: 206128
Diffstat (limited to 'clang/test/Parser/cxx0x-lambda-expressions.cpp')
-rw-r--r-- | clang/test/Parser/cxx0x-lambda-expressions.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/test/Parser/cxx0x-lambda-expressions.cpp b/clang/test/Parser/cxx0x-lambda-expressions.cpp index 53ea05ea860..8cfe7f3b02d 100644 --- a/clang/test/Parser/cxx0x-lambda-expressions.cpp +++ b/clang/test/Parser/cxx0x-lambda-expressions.cpp @@ -2,6 +2,8 @@ enum E { e }; +constexpr int id(int n) { return n; } + class C { int f() { @@ -34,12 +36,18 @@ class C { typedef int T; const int b = 0; const int c = 1; + int d; int a1[1] = {[b] (T()) {}}; // expected-error{{no viable conversion from '(lambda}} int a2[1] = {[b] = 1 }; - int a3[1] = {[b,c] = 1 }; // expected-error{{expected body of lambda expression}} + int a3[1] = {[b,c] = 1 }; // expected-error{{expected ']'}} expected-note {{to match}} int a4[1] = {[&b] = 1 }; // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'const int *'}} int a5[3] = { []{return 0;}() }; int a6[1] = {[this] = 1 }; // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'C *'}} + int a7[1] = {[d(0)] { return d; } ()}; // expected-warning{{extension}} + int a8[1] = {[d = 0] { return d; } ()}; // expected-warning{{extension}} + int a9[1] = {[d = 0] = 1}; // expected-error{{is not an integral constant expression}} + int a10[1] = {[id(0)] { return id; } ()}; // expected-warning{{extension}} + int a11[1] = {[id(0)] = 1}; } void delete_lambda(int *p) { |