[libcxx-commits] [libcxx] [libc++] Add static_assert diagnostics for LWG3133 named requirements (PR #212360)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 28 01:28:43 PDT 2026
================
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// <valarray>
+
+// template<class T>
+// class valarray
+//
+// T shall be a cv-unqualified object type that satisfies the Cpp17DefaultConstructible,
+// Cpp17CopyConstructible, Cpp17CopyAssignable, and Cpp17Destructible requirements (LWG3133)
+
+#include <valarray>
+
+struct NotDefaultConstructible {
+ NotDefaultConstructible() = delete;
+};
+
+struct NotCopyConstructible {
+ NotCopyConstructible() = default;
+ NotCopyConstructible(const NotCopyConstructible&) = delete;
+};
+
+struct NotCopyAssignable {
+ NotCopyAssignable() = default;
+ NotCopyAssignable(const NotCopyAssignable&) = default;
+ NotCopyAssignable& operator=(const NotCopyAssignable&) = delete;
+};
+
+struct NotDestructible {
+ NotDestructible() = default;
+ NotDestructible(const NotDestructible&) = default;
+ NotDestructible& operator=(const NotDestructible&) = default;
+
+private:
+ ~NotDestructible() = default;
+};
+
+void test() {
+ // expected-error-re at valarray:* {{static assertion failed{{.*}}std::valarray<T> requires T to be a cv-unqualified object type}}
----------------
H-G-Hristov wrote:
```suggestion
// expected-error-re at +1 {{static assertion failed{{.*}}std::valarray<T> requires T to be a cv-unqualified object type}}
```
IMO: The "check" feels too generic. How about this?
https://github.com/llvm/llvm-project/pull/212360
More information about the libcxx-commits
mailing list