summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp12
-rw-r--r--clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp2
-rw-r--r--clang/test/SemaCXX/for-range-examples.cpp8
3 files changed, 13 insertions, 9 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
diff --git a/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp b/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
index 3d5509eedf6..bdf6847ec3d 100644
--- a/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
+++ b/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
@@ -6,7 +6,7 @@
namespace test_lambda_is_literal {
#ifdef CPP14_AND_EARLIER
//expected-error@+4{{not a literal type}}
-//expected-note@+2{{not an aggregate and has no constexpr constructors}}
+//expected-note@+2{{lambda closure types are non-literal types before C++17}}
#endif
auto L = [] { };
constexpr int foo(decltype(L) l) { return 0; }
diff --git a/clang/test/SemaCXX/for-range-examples.cpp b/clang/test/SemaCXX/for-range-examples.cpp
index d6b527ff8a5..4fb3d3b3d53 100644
--- a/clang/test/SemaCXX/for-range-examples.cpp
+++ b/clang/test/SemaCXX/for-range-examples.cpp
@@ -221,11 +221,7 @@ namespace test7 {
for (c alignas(8) : arr) { // expected-error {{requires type for loop variable}}
static_assert(alignof(c) == 8, ""); // expected-warning {{extension}}
}
- // FIXME: The fix-it hint here is not sufficient to fix the error.
- // We fail to diagnose that d is underaligned for its type, because
- // we check the alignment attribute before we perform the auto
- // deduction.
- for (d alignas(1) : arr) {} // expected-error {{requires type for loop variable}}
+ for (d alignas(1) : arr) {} // expected-error {{requested alignment is less than minimum alignment of 8 for type 'int &'}} expected-error {{requires type for loop variable}}
for (e [[deprecated]] : arr) { e = 0; } // expected-warning {{deprecated}} expected-note {{here}} expected-error {{requires type for loop variable}}
}
}
@@ -274,4 +270,4 @@ int foo(int b) {
}();
return b;
}
-} \ No newline at end of file
+}
OpenPOWER on IntegriCloud