summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX
diff options
context:
space:
mode:
authorRichard Smith <richard@metafoo.co.uk>2019-12-19 15:18:59 -0800
committerRichard Smith <richard@metafoo.co.uk>2019-12-19 15:20:10 -0800
commitf4a45c2ce4ce2a7a33d5773048682e65f348a486 (patch)
tree5006bf3f2050e83a5f1cc9996ffce05bac7efcb5 /clang/test/CXX
parentb284005072122fe4af879725e3c8090009f89ca0 (diff)
downloadbcm5719-llvm-f4a45c2ce4ce2a7a33d5773048682e65f348a486.tar.gz
bcm5719-llvm-f4a45c2ce4ce2a7a33d5773048682e65f348a486.zip
Fix crash on init-capture packs where the type of the initializer is non-dependent.
Diffstat (limited to 'clang/test/CXX')
-rw-r--r--clang/test/CXX/temp/temp.decls/temp.variadic/init-capture.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/CXX/temp/temp.decls/temp.variadic/init-capture.cpp b/clang/test/CXX/temp/temp.decls/temp.variadic/init-capture.cpp
index 4d5b6b47459..ce2fccc8fe6 100644
--- a/clang/test/CXX/temp/temp.decls/temp.variadic/init-capture.cpp
+++ b/clang/test/CXX/temp/temp.decls/temp.variadic/init-capture.cpp
@@ -37,3 +37,11 @@ template<typename ...T> void f(T ...t) {
}... // expected-error {{does not contain any unexpanded}}
);
}
+
+template<int ...a> constexpr auto x = [...z = a] (auto F) { return F(z...); };
+static_assert(x<1,2,3>([](int a, int b, int c) { return 100 * a + 10 * b + c; }) == 123);
+static_assert(x<1,2,3>([](int a, int b, int c) { return 100 * a + 10 * b + c; }) == 124); // expected-error {{failed}}
+
+template<int ...a> constexpr auto y = [z = a...] (auto F) { return F(z...); }; // expected-error {{must appear before the name of the capture}}
+static_assert(y<1,2,3>([](int a, int b, int c) { return 100 * a + 10 * b + c; }) == 123);
+static_assert(y<1,2,3>([](int a, int b, int c) { return 100 * a + 10 * b + c; }) == 124); // expected-error {{failed}}
OpenPOWER on IntegriCloud