summaryrefslogtreecommitdiff
path: root/test/CXX/drs/dr14xx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/drs/dr14xx.cpp')
-rw-r--r--test/CXX/drs/dr14xx.cpp59
1 files changed, 45 insertions, 14 deletions
diff --git a/test/CXX/drs/dr14xx.cpp b/test/CXX/drs/dr14xx.cpp
index eb086178fc..52129844c4 100644
--- a/test/CXX/drs/dr14xx.cpp
+++ b/test/CXX/drs/dr14xx.cpp
@@ -1,7 +1,8 @@
// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2a %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
#if __cplusplus < 201103L
// expected-no-diagnostics
@@ -38,18 +39,24 @@ namespace dr1460 { // dr1460: 3.5
}
union A {};
- union B { int n; }; // expected-note +{{here}}
+ union B { int n; }; // expected-note 0+{{here}}
union C { int n = 0; };
struct D { union {}; }; // expected-error {{does not declare anything}}
- struct E { union { int n; }; }; // expected-note +{{here}}
+ struct E { union { int n; }; }; // expected-note 0+{{here}}
struct F { union { int n = 0; }; };
struct X {
friend constexpr A::A() noexcept;
- friend constexpr B::B() noexcept; // expected-error {{follows non-constexpr declaration}}
+ friend constexpr B::B() noexcept;
+#if __cplusplus <= 201703L
+ // expected-error@-2 {{follows non-constexpr declaration}}
+#endif
friend constexpr C::C() noexcept;
friend constexpr D::D() noexcept;
- friend constexpr E::E() noexcept; // expected-error {{follows non-constexpr declaration}}
+ friend constexpr E::E() noexcept;
+#if __cplusplus <= 201703L
+ // expected-error@-2 {{follows non-constexpr declaration}}
+#endif
friend constexpr F::F() noexcept;
};
@@ -64,37 +71,61 @@ namespace dr1460 { // dr1460: 3.5
namespace Defaulted {
union A { constexpr A() = default; };
- union B { int n; constexpr B() = default; }; // expected-error {{not constexpr}}
+ union B { int n; constexpr B() = default; };
+#if __cplusplus <= 201703L
+ // expected-error@-2 {{not constexpr}}
+#endif
union C { int n = 0; constexpr C() = default; };
struct D { union {}; constexpr D() = default; }; // expected-error {{does not declare anything}}
- struct E { union { int n; }; constexpr E() = default; }; // expected-error {{not constexpr}}
+ struct E { union { int n; }; constexpr E() = default; };
+#if __cplusplus <= 201703L
+ // expected-error@-2 {{not constexpr}}
+#endif
struct F { union { int n = 0; }; constexpr F() = default; };
- struct G { union { int n = 0; }; union { int m; }; constexpr G() = default; }; // expected-error {{not constexpr}}
+ struct G { union { int n = 0; }; union { int m; }; constexpr G() = default; };
+#if __cplusplus <= 201703L
+ // expected-error@-2 {{not constexpr}}
+#endif
struct H {
union {
int n = 0;
};
- union { // expected-note 2{{member not initialized}}
+ union { // expected-note 0-2{{member not initialized}}
int m;
};
- constexpr H() {} // expected-error {{must initialize all members}}
+ constexpr H() {}
+#if __cplusplus <= 201703L
+ // expected-error@-2 {{initialize all members}}
+#endif
constexpr H(bool) : m(1) {}
- constexpr H(char) : n(1) {} // expected-error {{must initialize all members}}
+ constexpr H(char) : n(1) {}
+#if __cplusplus <= 201703L
+ // expected-error@-2 {{initialize all members}}
+#endif
constexpr H(double) : m(1), n(1) {}
};
}
#if __cplusplus > 201103L
template<typename T> constexpr bool check() {
- T t; // expected-note-re 2{{non-constexpr constructor '{{[BE]}}'}}
+ T t;
+#if __cplusplus <= 201703L
+ // expected-note-re@-2 2{{non-constexpr constructor '{{[BE]}}'}}
+#endif
return true;
}
static_assert(check<A>(), "");
- static_assert(check<B>(), ""); // expected-error {{constant}} expected-note {{in call}}
+ static_assert(check<B>(), "");
+#if __cplusplus <= 201703L
+ // expected-error@-2 {{constant}} expected-note@-2 {{in call}}
+#endif
static_assert(check<C>(), "");
static_assert(check<D>(), "");
- static_assert(check<E>(), ""); // expected-error {{constant}} expected-note {{in call}}
+ static_assert(check<E>(), "");
+#if __cplusplus <= 201703L
+ // expected-error@-2 {{constant}} expected-note@-2 {{in call}}
+#endif
static_assert(check<F>(), "");
#endif