[libcxx-commits] [libcxx] [libc++]libcxx constexpr deque (PR #200929)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 3 21:12:49 PDT 2026
================
@@ -47,7 +49,23 @@ C make(int size, int start = 0) {
return c;
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ assert(d[0] == 1);
+ assert(d.at(2) == 3);
+ assert(d.front() == 1);
+ assert(d.back() == 3);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
----------------
Serosh-commits wrote:
> no need for the `assert()`;
>
> FYI (no changes requested) The typical pattern is:
>
> ```
> constexpr bool test() {
> assert(...);
>
> return true;
> }
>
> test(); // runtime
> static_assert(test());
>
> And we want to run the same tests at runtime and compile-time.
> ```
done updated this throughout all the tests
https://github.com/llvm/llvm-project/pull/200929
More information about the libcxx-commits
mailing list