summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/expr/expr.prim
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CXX/expr/expr.prim')
-rw-r--r--clang/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp
index 80771d7a229..db40bd5d142 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp
@@ -1,11 +1,19 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
+// RUN: %clang_cc1 -fsyntax-only -std=c++14 %s -verify
+// RUN: %clang_cc1 -fsyntax-only -std=c++17 %s -verify
void test_nonaggregate(int i) {
auto lambda = [i]() -> void {}; // expected-note 2{{candidate constructor}}
decltype(lambda) foo = { 1 }; // expected-error{{no matching constructor}}
- static_assert(!__is_literal(decltype(lambda)), "");
+ static_assert(__is_literal(decltype(lambda)) == (__cplusplus >= 201703L), "");
auto lambda2 = []{}; // expected-note 2{{candidate constructor}}
decltype(lambda2) bar = {}; // expected-error{{no matching constructor}}
- static_assert(!__is_literal(decltype(lambda2)), "");
+ static_assert(__is_literal(decltype(lambda2)) == (__cplusplus >= 201703L), "");
}
+
+constexpr auto literal = []{};
+#if __cplusplus < 201703L
+// expected-error@-2 {{constexpr variable cannot have non-literal type}}
+// expected-note@-3 {{lambda closure types are non-literal types before C++17}}
+#endif
OpenPOWER on IntegriCloud