summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx1z-decomposition.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-08-15 02:34:23 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-08-15 02:34:23 +0000
commit1879f1069b607b5cb3a16a0500bcb25e871d3b23 (patch)
treeb10bbc4a902386968ddf26a938f1bdb88ecd07c0 /clang/test/SemaCXX/cxx1z-decomposition.cpp
parent39a7c4c65afa08e620f14f52d5c67776c7f255f7 (diff)
downloadbcm5719-llvm-1879f1069b607b5cb3a16a0500bcb25e871d3b23.tar.gz
bcm5719-llvm-1879f1069b607b5cb3a16a0500bcb25e871d3b23.zip
Disable lambda-capture of decomposition declaration bindings for now, until CWG
agrees on how they're supposed to work. llvm-svn: 278648
Diffstat (limited to 'clang/test/SemaCXX/cxx1z-decomposition.cpp')
-rw-r--r--clang/test/SemaCXX/cxx1z-decomposition.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx1z-decomposition.cpp b/clang/test/SemaCXX/cxx1z-decomposition.cpp
index 0ddd9ea3046..12c863c8c3f 100644
--- a/clang/test/SemaCXX/cxx1z-decomposition.cpp
+++ b/clang/test/SemaCXX/cxx1z-decomposition.cpp
@@ -37,4 +37,14 @@ constexpr bool g(S &&s) {
}
static_assert(g({1, 2}));
+void enclosing() {
+ struct S { int a; };
+ auto [n] = S(); // expected-note 2{{'n' declared here}}
+
+ struct Q { int f() { return n; } }; // expected-error {{reference to local binding 'n' declared in enclosing function}}
+ // FIXME: This is probably supposed to be valid, but we do not have clear rules on how it's supposed to work.
+ (void) [&] { return n; }; // expected-error {{reference to local binding 'n' declared in enclosing function}}
+ (void) [n] {}; // expected-error {{'n' in capture list does not name a variable}}
+}
+
// FIXME: by-value array copies
OpenPOWER on IntegriCloud