[libcxx-commits] [libcxx] [libc++] Refactor container's types.pass.cpp tests (PR #223602)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Sep 14 23:51:58 PDT 2026
https://github.com/H-G-Hristov updated https://github.com/llvm/llvm-project/pull/223602
>From e074eb947a9bf02434dec6738443dc1961df0f65 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Tue, 15 Sep 2026 07:49:45 +0300
Subject: [PATCH 1/2] [libc++][deque] Refactor types.pass.cpp
Convert types.pass.cpp to a compile only test.
---
.../deque/{types.pass.cpp => types.compile.pass.cpp} | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
rename libcxx/test/std/containers/sequences/deque/{types.pass.cpp => types.compile.pass.cpp} (99%)
diff --git a/libcxx/test/std/containers/sequences/deque/types.pass.cpp b/libcxx/test/std/containers/sequences/deque/types.compile.pass.cpp
similarity index 99%
rename from libcxx/test/std/containers/sequences/deque/types.pass.cpp
rename to libcxx/test/std/containers/sequences/deque/types.compile.pass.cpp
index 8184d55873d20..e735f3f1d40c4 100644
--- a/libcxx/test/std/containers/sequences/deque/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/types.compile.pass.cpp
@@ -77,7 +77,7 @@ void test() {
"");
}
-int main(int, char**) {
+void test() {
test<int, test_allocator<int> >();
test<int*, std::allocator<int*> >();
test<Copyable, test_allocator<Copyable> >();
@@ -106,6 +106,4 @@ int main(int, char**) {
"");
}
#endif
-
- return 0;
}
>From 6780545b2cd1f6faf6c14ee0763517c6eeb21fae Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Tue, 15 Sep 2026 09:22:08 +0300
Subject: [PATCH 2/2] Convert all tests
---
...{types.pass.cpp => types.compile.pass.cpp} | 13 +---
...{types.pass.cpp => types.compile.pass.cpp} | 16 +----
...{types.pass.cpp => types.compile.pass.cpp} | 6 +-
...{types.pass.cpp => types.compile.pass.cpp} | 14 +---
.../priority.queue/derived.pass.cpp | 41 +++++++++++
.../priority.queue/types.compile.fail.cpp | 4 +-
.../priority.queue/types.compile.pass.cpp | 53 ++++++++++++++
.../priority.queue/types.pass.cpp | 70 -------------------
...{types.pass.cpp => types.compile.pass.cpp} | 7 +-
...{types.pass.cpp => types.compile.pass.cpp} | 6 +-
...{types.pass.cpp => types.compile.pass.cpp} | 7 +-
...{types.pass.cpp => types.compile.pass.cpp} | 4 +-
...{types.pass.cpp => types.compile.pass.cpp} | 4 +-
...{types.pass.cpp => types.compile.pass.cpp} | 6 +-
...{types.pass.cpp => types.compile.pass.cpp} | 6 +-
...{types.pass.cpp => types.compile.pass.cpp} | 6 +-
...{types.pass.cpp => types.compile.pass.cpp} | 6 +-
...{types.pass.cpp => types.compile.pass.cpp} | 3 +-
...{types.pass.cpp => types.compile.pass.cpp} | 4 +-
19 files changed, 133 insertions(+), 143 deletions(-)
rename libcxx/test/std/containers/associative/map/{types.pass.cpp => types.compile.pass.cpp} (95%)
rename libcxx/test/std/containers/associative/multimap/{types.pass.cpp => types.compile.pass.cpp} (95%)
rename libcxx/test/std/containers/associative/multiset/{types.pass.cpp => types.compile.pass.cpp} (98%)
rename libcxx/test/std/containers/associative/set/{types.pass.cpp => types.compile.pass.cpp} (95%)
create mode 100644 libcxx/test/std/containers/container.adaptors/priority.queue/derived.pass.cpp
create mode 100644 libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.pass.cpp
delete mode 100644 libcxx/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
rename libcxx/test/std/containers/sequences/array/{types.pass.cpp => types.compile.pass.cpp} (99%)
rename libcxx/test/std/containers/sequences/forwardlist/{types.pass.cpp => types.compile.pass.cpp} (99%)
rename libcxx/test/std/containers/sequences/list/{types.pass.cpp => types.compile.pass.cpp} (99%)
rename libcxx/test/std/containers/sequences/vector.bool/{types.pass.cpp => types.compile.pass.cpp} (99%)
rename libcxx/test/std/containers/sequences/vector/{types.pass.cpp => types.compile.pass.cpp} (99%)
rename libcxx/test/std/containers/unord/unord.map/{types.pass.cpp => types.compile.pass.cpp} (99%)
rename libcxx/test/std/containers/unord/unord.multimap/{types.pass.cpp => types.compile.pass.cpp} (99%)
rename libcxx/test/std/containers/unord/unord.multiset/{types.pass.cpp => types.compile.pass.cpp} (99%)
rename libcxx/test/std/containers/unord/unord.set/{types.pass.cpp => types.compile.pass.cpp} (99%)
rename libcxx/test/std/containers/views/mdspan/mdspan/{types.pass.cpp => types.compile.pass.cpp} (99%)
rename libcxx/test/std/containers/views/views.span/{types.pass.cpp => types.compile.pass.cpp} (98%)
diff --git a/libcxx/test/std/containers/associative/map/types.pass.cpp b/libcxx/test/std/containers/associative/map/types.compile.pass.cpp
similarity index 95%
rename from libcxx/test/std/containers/associative/map/types.pass.cpp
rename to libcxx/test/std/containers/associative/map/types.compile.pass.cpp
index e69eb59081043..7f148fc7b287d 100644
--- a/libcxx/test/std/containers/associative/map/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/types.compile.pass.cpp
@@ -34,9 +34,10 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX26 bool test() {
+void test() {
{
typedef std::map<int, double> C;
+
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::mapped_type, double>::value), "");
static_assert((std::is_same<C::value_type, std::pair<const int, double> >::value), "");
@@ -52,6 +53,7 @@ TEST_CONSTEXPR_CXX26 bool test() {
#if TEST_STD_VER >= 11
{
typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
+
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::mapped_type, double>::value), "");
static_assert((std::is_same<C::value_type, std::pair<const int, double> >::value), "");
@@ -66,13 +68,4 @@ TEST_CONSTEXPR_CXX26 bool test() {
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
#endif
- return true;
-}
-
-int main(int, char**) {
- test();
-#if TEST_STD_VER >= 26
- static_assert(test());
-#endif
- return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/types.pass.cpp b/libcxx/test/std/containers/associative/multimap/types.compile.pass.cpp
similarity index 95%
rename from libcxx/test/std/containers/associative/multimap/types.pass.cpp
rename to libcxx/test/std/containers/associative/multimap/types.compile.pass.cpp
index 0f2d6190c1fc5..8d7626c8ba257 100644
--- a/libcxx/test/std/containers/associative/multimap/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/types.compile.pass.cpp
@@ -34,10 +34,10 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX26
-bool test() {
+void test() {
{
typedef std::multimap<int, double> C;
+
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::mapped_type, double>::value), "");
static_assert((std::is_same<C::value_type, std::pair<const int, double> >::value), "");
@@ -53,6 +53,7 @@ bool test() {
#if TEST_STD_VER >= 11
{
typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
+
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::mapped_type, double>::value), "");
static_assert((std::is_same<C::value_type, std::pair<const int, double> >::value), "");
@@ -67,15 +68,4 @@ bool test() {
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
#endif
-
- return true;
-}
-
-int main(int, char**) {
- test();
-
-#if TEST_STD_VER >= 26
- static_assert(test());
-#endif
- return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/types.pass.cpp b/libcxx/test/std/containers/associative/multiset/types.compile.pass.cpp
similarity index 98%
rename from libcxx/test/std/containers/associative/multiset/types.pass.cpp
rename to libcxx/test/std/containers/associative/multiset/types.compile.pass.cpp
index 3595f7a8b5e0d..834353987acb8 100644
--- a/libcxx/test/std/containers/associative/multiset/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/types.compile.pass.cpp
@@ -34,9 +34,10 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+void test() {
{
typedef std::multiset<int> C;
+
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::value_type, int>::value), "");
static_assert((std::is_same<C::key_compare, std::less<int> >::value), "");
@@ -52,6 +53,7 @@ int main(int, char**) {
#if TEST_STD_VER >= 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
+
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::value_type, int>::value), "");
static_assert((std::is_same<C::key_compare, std::less<int> >::value), "");
@@ -66,6 +68,4 @@ int main(int, char**) {
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
#endif
-
- return 0;
}
diff --git a/libcxx/test/std/containers/associative/set/types.pass.cpp b/libcxx/test/std/containers/associative/set/types.compile.pass.cpp
similarity index 95%
rename from libcxx/test/std/containers/associative/set/types.pass.cpp
rename to libcxx/test/std/containers/associative/set/types.compile.pass.cpp
index c7376a16ae85a..19e678ff7f6b9 100644
--- a/libcxx/test/std/containers/associative/set/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/set/types.compile.pass.cpp
@@ -34,9 +34,10 @@
#include "test_macros.h"
#include "min_allocator.h"
-TEST_CONSTEXPR_CXX26 bool test() {
+void test() {
{
typedef std::set<int> C;
+
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::value_type, int>::value), "");
static_assert((std::is_same<C::key_compare, std::less<int> >::value), "");
@@ -52,6 +53,7 @@ TEST_CONSTEXPR_CXX26 bool test() {
#if TEST_STD_VER >= 11
{
typedef std::set<int, std::less<int>, min_allocator<int>> C;
+
static_assert((std::is_same<C::key_type, int>::value), "");
static_assert((std::is_same<C::value_type, int>::value), "");
static_assert((std::is_same<C::key_compare, std::less<int> >::value), "");
@@ -66,14 +68,4 @@ TEST_CONSTEXPR_CXX26 bool test() {
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
#endif
-
- return true;
-}
-
-int main(int, char**) {
- test();
-#if TEST_STD_VER >= 26
- static_assert(test());
-#endif
- return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/derived.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/derived.pass.cpp
new file mode 100644
index 0000000000000..7fc92b413af66
--- /dev/null
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/derived.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class T, class Container = vector<T>,
+// class Compare = less<typename Container::value_type>>
+// class priority_queue
+// {
+// public:
+// typedef Container container_type;
+// typedef Compare value_compare; // LWG#2684
+// typedef typename container_type::value_type value_type;
+// typedef typename container_type::reference reference;
+// typedef typename container_type::const_reference const_reference;
+// typedef typename container_type::size_type size_type;
+//
+// protected:
+// container_type c;
+// Compare comp;
+
+#include <queue>
+#include <cassert>
+
+struct test_derived : private std::priority_queue<int> {
+ test_derived() {
+ c.push_back(1);
+ assert(comp(1, 2));
+ }
+};
+
+int main(int, char**) {
+ test_derived t;
+
+ return 0;
+}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.fail.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.fail.cpp
index 0dfbe06cf1839..4359755d0a3fb 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.fail.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.fail.cpp
@@ -27,9 +27,7 @@
#include <cassert>
#include <type_traits>
-int main(int, char**) {
+void test() {
// LWG#2566 says that the first template param must match the second one's value type
std::priority_queue<double, std::deque<int>> t;
-
- return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.pass.cpp
new file mode 100644
index 0000000000000..1fc7092ff19b7
--- /dev/null
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/types.compile.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// template <class T, class Container = vector<T>,
+// class Compare = less<typename Container::value_type>>
+// class priority_queue
+// {
+// public:
+// typedef Container container_type;
+// typedef Compare value_compare; // LWG#2684
+// typedef typename container_type::value_type value_type;
+// typedef typename container_type::reference reference;
+// typedef typename container_type::const_reference const_reference;
+// typedef typename container_type::size_type size_type;
+//
+// protected:
+// container_type c;
+// Compare comp;
+
+#include <queue>
+#include <deque>
+#include <functional>
+#include <memory>
+#include <type_traits>
+#include <vector>
+
+struct C {
+ typedef int value_type;
+ typedef int& reference;
+ typedef const int& const_reference;
+ typedef int size_type;
+};
+
+static_assert((std::is_same<std::priority_queue<int>::container_type, std::vector<int> >::value), "");
+static_assert((std::is_same<std::priority_queue<int, std::deque<int> >::container_type, std::deque<int> >::value), "");
+static_assert((std::is_same<std::priority_queue<int, std::deque<int> >::value_type, int>::value), "");
+static_assert((std::is_same<std::priority_queue<int>::reference, std::vector<int>::reference>::value), "");
+static_assert((std::is_same<std::priority_queue<int>::const_reference, std::vector<int>::const_reference>::value), "");
+static_assert((std::is_same<std::priority_queue<int>::size_type, std::vector<int>::size_type>::value), "");
+static_assert((std::is_same<std::priority_queue<int>::value_compare, std::less<int> >::value), "");
+static_assert((std::is_same<std::priority_queue<int, std::deque<int> >::value_compare, std::less<int> >::value), "");
+static_assert((std::is_same<std::priority_queue<int, std::deque<int>, std::greater<int> >::value_compare,
+ std::greater<int> >::value),
+ "");
+static_assert((std::uses_allocator<std::priority_queue<int>, std::allocator<int> >::value), "");
+static_assert((!std::uses_allocator<std::priority_queue<int, C>, std::allocator<int> >::value), "");
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/types.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
deleted file mode 100644
index d90933925a73b..0000000000000
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// <queue>
-
-// template <class T, class Container = vector<T>,
-// class Compare = less<typename Container::value_type>>
-// class priority_queue
-// {
-// public:
-// typedef Container container_type;
-// typedef Compare value_compare; // LWG#2684
-// typedef typename container_type::value_type value_type;
-// typedef typename container_type::reference reference;
-// typedef typename container_type::const_reference const_reference;
-// typedef typename container_type::size_type size_type;
-//
-// protected:
-// container_type c;
-// Compare comp;
-
-#include <queue>
-#include <cassert>
-#include <deque>
-#include <functional>
-#include <memory>
-#include <type_traits>
-#include <vector>
-
-#include "test_macros.h"
-
-struct test : private std::priority_queue<int> {
- test() {
- c.push_back(1);
- assert(comp(1, 2));
- }
-};
-
-struct C {
- typedef int value_type;
- typedef int& reference;
- typedef const int& const_reference;
- typedef int size_type;
-};
-
-int main(int, char**) {
- static_assert((std::is_same<std::priority_queue<int>::container_type, std::vector<int> >::value), "");
- static_assert(
- (std::is_same<std::priority_queue<int, std::deque<int> >::container_type, std::deque<int> >::value), "");
- static_assert((std::is_same<std::priority_queue<int, std::deque<int> >::value_type, int>::value), "");
- static_assert((std::is_same<std::priority_queue<int>::reference, std::vector<int>::reference>::value), "");
- static_assert(
- (std::is_same<std::priority_queue<int>::const_reference, std::vector<int>::const_reference>::value), "");
- static_assert((std::is_same<std::priority_queue<int>::size_type, std::vector<int>::size_type>::value), "");
- static_assert((std::is_same<std::priority_queue<int>::value_compare, std::less<int> >::value), "");
- static_assert((std::is_same<std::priority_queue<int, std::deque<int> >::value_compare, std::less<int> >::value), "");
- static_assert((std::is_same<std::priority_queue<int, std::deque<int>, std::greater<int> >::value_compare,
- std::greater<int> >::value),
- "");
- static_assert((std::uses_allocator<std::priority_queue<int>, std::allocator<int> >::value), "");
- static_assert((!std::uses_allocator<std::priority_queue<int, C>, std::allocator<int> >::value), "");
- test t;
-
- return 0;
-}
diff --git a/libcxx/test/std/containers/sequences/array/types.pass.cpp b/libcxx/test/std/containers/sequences/array/types.compile.pass.cpp
similarity index 99%
rename from libcxx/test/std/containers/sequences/array/types.pass.cpp
rename to libcxx/test/std/containers/sequences/array/types.compile.pass.cpp
index f216d3ed15849..86346ee09b9b1 100644
--- a/libcxx/test/std/containers/sequences/array/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/array/types.compile.pass.cpp
@@ -34,6 +34,7 @@ template <class C>
void test_iterators() {
typedef std::iterator_traits<typename C::iterator> ItT;
typedef std::iterator_traits<typename C::const_iterator> CItT;
+
static_assert((std::is_same<typename ItT::iterator_category, std::random_access_iterator_tag>::value), "");
static_assert((std::is_same<typename ItT::value_type, typename C::value_type>::value), "");
static_assert((std::is_same<typename ItT::reference, typename C::reference>::value), "");
@@ -47,10 +48,11 @@ void test_iterators() {
static_assert((std::is_same<typename CItT::difference_type, typename C::difference_type>::value), "");
}
-int main(int, char**) {
+void test() {
{
typedef double T;
typedef std::array<T, 10> C;
+
static_assert((std::is_same<C::reference, T&>::value), "");
static_assert((std::is_same<C::const_reference, const T&>::value), "");
test_iterators<C>();
@@ -73,6 +75,7 @@ int main(int, char**) {
{
typedef int* T;
typedef std::array<T, 0> C;
+
static_assert((std::is_same<C::reference, T&>::value), "");
static_assert((std::is_same<C::const_reference, const T&>::value), "");
test_iterators<C>();
@@ -92,6 +95,4 @@ int main(int, char**) {
typename std::iterator_traits<typename C::const_iterator>::difference_type>::value),
"");
}
-
- return 0;
}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/types.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/types.compile.pass.cpp
similarity index 99%
rename from libcxx/test/std/containers/sequences/forwardlist/types.pass.cpp
rename to libcxx/test/std/containers/sequences/forwardlist/types.compile.pass.cpp
index 58b73415f1a72..7b37db6a700ba 100644
--- a/libcxx/test/std/containers/sequences/forwardlist/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/forwardlist/types.compile.pass.cpp
@@ -52,9 +52,10 @@ struct A {
std::forward_list<A> v;
}; // incomplete type support
-int main(int, char**) {
+void test() {
{
typedef std::forward_list<char> C;
+
static_assert((std::is_same<C::value_type, char>::value), "");
static_assert((std::is_same<C::allocator_type, std::allocator<char> >::value), "");
static_assert((std::is_same<C::reference, char&>::value), "");
@@ -76,6 +77,7 @@ int main(int, char**) {
#if TEST_STD_VER >= 11
{
typedef std::forward_list<char, min_allocator<char>> C;
+
static_assert((std::is_same<C::value_type, char>::value), "");
static_assert((std::is_same<C::allocator_type, min_allocator<char> >::value), "");
static_assert((std::is_same<C::reference, char&>::value), "");
@@ -96,6 +98,4 @@ int main(int, char**) {
"");
}
#endif
-
- return 0;
}
diff --git a/libcxx/test/std/containers/sequences/list/types.pass.cpp b/libcxx/test/std/containers/sequences/list/types.compile.pass.cpp
similarity index 99%
rename from libcxx/test/std/containers/sequences/list/types.pass.cpp
rename to libcxx/test/std/containers/sequences/list/types.compile.pass.cpp
index 7075f6eff0b2b..e640a0036f815 100644
--- a/libcxx/test/std/containers/sequences/list/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/types.compile.pass.cpp
@@ -49,9 +49,10 @@ struct A {
std::list<A> v;
}; // incomplete type support
-int main(int, char**) {
+void test() {
{
typedef std::list<int> C;
+
static_assert((std::is_same<C::value_type, int>::value), "");
static_assert((std::is_same<C::allocator_type, std::allocator<int> >::value), "");
static_assert((std::is_same<C::reference, std::allocator_traits<std::allocator<int> >::value_type&>::value), "");
@@ -70,10 +71,10 @@ int main(int, char**) {
typename std::iterator_traits<typename C::const_iterator>::difference_type>::value),
"");
}
-
#if TEST_STD_VER >= 11
{
typedef std::list<int, min_allocator<int>> C;
+
static_assert((std::is_same<C::value_type, int>::value), "");
static_assert((std::is_same<C::allocator_type, min_allocator<int> >::value), "");
static_assert((std::is_same<C::reference, int&>::value), "");
@@ -91,6 +92,4 @@ int main(int, char**) {
"");
}
#endif
-
- return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector.bool/types.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/types.compile.pass.cpp
similarity index 99%
rename from libcxx/test/std/containers/sequences/vector.bool/types.pass.cpp
rename to libcxx/test/std/containers/sequences/vector.bool/types.compile.pass.cpp
index 4aaf02ef31f8b..a26004c47055e 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/types.compile.pass.cpp
@@ -72,13 +72,11 @@ void test() {
#endif
}
-int main(int, char**) {
+void test() {
test<test_allocator<bool> >();
test<std::allocator<bool> >();
static_assert((std::is_same<std::vector<bool>::allocator_type, std::allocator<bool> >::value), "");
#if TEST_STD_VER >= 11
test<min_allocator<bool> >();
#endif
-
- return 0;
}
diff --git a/libcxx/test/std/containers/sequences/vector/types.pass.cpp b/libcxx/test/std/containers/sequences/vector/types.compile.pass.cpp
similarity index 99%
rename from libcxx/test/std/containers/sequences/vector/types.pass.cpp
rename to libcxx/test/std/containers/sequences/vector/types.compile.pass.cpp
index c3aa60bd30c7e..cfdccde755916 100644
--- a/libcxx/test/std/containers/sequences/vector/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/types.compile.pass.cpp
@@ -84,7 +84,7 @@ void test() {
"");
}
-int main(int, char**) {
+void test() {
test<int, test_allocator<int> >();
test<int*, std::allocator<int*> >();
test<Copyable, test_allocator<Copyable> >();
@@ -107,6 +107,4 @@ int main(int, char**) {
// typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
}
#endif
-
- return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.map/types.pass.cpp b/libcxx/test/std/containers/unord/unord.map/types.compile.pass.cpp
similarity index 99%
rename from libcxx/test/std/containers/unord/unord.map/types.pass.cpp
rename to libcxx/test/std/containers/unord/unord.map/types.compile.pass.cpp
index c883d35f85ee6..1328fac9977ec 100644
--- a/libcxx/test/std/containers/unord/unord.map/types.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/types.compile.pass.cpp
@@ -33,9 +33,10 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+void test() {
{
typedef std::unordered_map<char, short> C;
+
static_assert((std::is_same<C::key_type, char>::value), "");
static_assert((std::is_same<C::mapped_type, short>::value), "");
static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
@@ -54,6 +55,7 @@ int main(int, char**) {
typedef std::
unordered_map<char, short, std::hash<char>, std::equal_to<char>, min_allocator<std::pair<const char, short>>>
C;
+
static_assert((std::is_same<C::key_type, char>::value), "");
static_assert((std::is_same<C::mapped_type, short>::value), "");
static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
@@ -69,6 +71,4 @@ int main(int, char**) {
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
#endif
-
- return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/types.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/types.compile.pass.cpp
similarity index 99%
rename from libcxx/test/std/containers/unord/unord.multimap/types.pass.cpp
rename to libcxx/test/std/containers/unord/unord.multimap/types.compile.pass.cpp
index e9f5878646dc8..9c0786c50404e 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/types.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/types.compile.pass.cpp
@@ -33,9 +33,10 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+void test() {
{
typedef std::unordered_multimap<char, short> C;
+
static_assert((std::is_same<C::key_type, char>::value), "");
static_assert((std::is_same<C::mapped_type, short>::value), "");
static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
@@ -57,6 +58,7 @@ int main(int, char**) {
std::equal_to<char>,
min_allocator<std::pair<const char, short>>>
C;
+
static_assert((std::is_same<C::key_type, char>::value), "");
static_assert((std::is_same<C::mapped_type, short>::value), "");
static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
@@ -72,6 +74,4 @@ int main(int, char**) {
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
#endif
-
- return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/types.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/types.compile.pass.cpp
similarity index 99%
rename from libcxx/test/std/containers/unord/unord.multiset/types.pass.cpp
rename to libcxx/test/std/containers/unord/unord.multiset/types.compile.pass.cpp
index 4e5b0e0ce6981..e3383a0519d08 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/types.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/types.compile.pass.cpp
@@ -32,9 +32,10 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+void test() {
{
typedef std::unordered_multiset<short> C;
+
static_assert((std::is_same<C::value_type, short>::value), "");
static_assert((std::is_same<C::key_type, short>::value), "");
static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
@@ -50,6 +51,7 @@ int main(int, char**) {
#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<short, std::hash<short>, std::equal_to<short>, min_allocator<short>> C;
+
static_assert((std::is_same<C::value_type, short>::value), "");
static_assert((std::is_same<C::key_type, short>::value), "");
static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
@@ -64,6 +66,4 @@ int main(int, char**) {
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
#endif
-
- return 0;
}
diff --git a/libcxx/test/std/containers/unord/unord.set/types.pass.cpp b/libcxx/test/std/containers/unord/unord.set/types.compile.pass.cpp
similarity index 99%
rename from libcxx/test/std/containers/unord/unord.set/types.pass.cpp
rename to libcxx/test/std/containers/unord/unord.set/types.compile.pass.cpp
index 623da69aba239..889b59a568132 100644
--- a/libcxx/test/std/containers/unord/unord.set/types.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/types.compile.pass.cpp
@@ -32,9 +32,10 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+void test() {
{
typedef std::unordered_set<short> C;
+
static_assert((std::is_same<C::value_type, short>::value), "");
static_assert((std::is_same<C::key_type, short>::value), "");
static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
@@ -50,6 +51,7 @@ int main(int, char**) {
#if TEST_STD_VER >= 11
{
typedef std::unordered_set<short, std::hash<short>, std::equal_to<short>, min_allocator<short>> C;
+
static_assert((std::is_same<C::value_type, short>::value), "");
static_assert((std::is_same<C::key_type, short>::value), "");
static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
@@ -64,6 +66,4 @@ int main(int, char**) {
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
#endif
-
- return 0;
}
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/types.pass.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/types.compile.pass.cpp
similarity index 99%
rename from libcxx/test/std/containers/views/mdspan/mdspan/types.pass.cpp
rename to libcxx/test/std/containers/views/mdspan/mdspan/types.compile.pass.cpp
index b576419828b71..ea26c6388e617 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/types.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/types.compile.pass.cpp
@@ -158,7 +158,7 @@ void mixin_accessor() {
mixin_layout<T, checked_accessor<T>>();
}
-int main(int, char**) {
+void test() {
mixin_accessor<int>();
mixin_accessor<const int>();
mixin_accessor<double>();
@@ -176,5 +176,4 @@ int main(int, char**) {
true,
true,
true>();
- return 0;
}
diff --git a/libcxx/test/std/containers/views/views.span/types.pass.cpp b/libcxx/test/std/containers/views/views.span/types.compile.pass.cpp
similarity index 98%
rename from libcxx/test/std/containers/views/views.span/types.pass.cpp
rename to libcxx/test/std/containers/views/views.span/types.compile.pass.cpp
index 22e19761122ba..aaf14f85ba7ad 100644
--- a/libcxx/test/std/containers/views/views.span/types.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/types.compile.pass.cpp
@@ -75,12 +75,10 @@ void test() {
struct A {};
-int main(int, char**) {
+void test() {
test<int>();
test<long>();
test<double>();
test<std::string>();
test<A>();
-
- return 0;
}
More information about the libcxx-commits
mailing list