[libcxx-commits] [libcxx] 01a1ca7 - [libc++][NFC] Format a pait test
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Nov 19 04:53:50 PST 2024
Author: Nikolas Klauser
Date: 2024-11-19T13:53:43+01:00
New Revision: 01a1ca72e86e293822dedb7fb1bd6f2095f2dbe4
URL: https://github.com/llvm/llvm-project/commit/01a1ca72e86e293822dedb7fb1bd6f2095f2dbe4
DIFF: https://github.com/llvm/llvm-project/commit/01a1ca72e86e293822dedb7fb1bd6f2095f2dbe4.diff
LOG: [libc++][NFC] Format a pait test
I'll be modifying this test in a future PR.
Added:
Modified:
libcxx/test/std/utilities/utility/pairs/pairs.pair/ctor.default.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/utilities/utility/pairs/pairs.pair/ctor.default.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.pair/ctor.default.pass.cpp
index dc05a2b4885943..9c1adf5937cc0c 100644
--- a/libcxx/test/std/utilities/utility/pairs/pairs.pair/ctor.default.pass.cpp
+++ b/libcxx/test/std/utilities/utility/pairs/pairs.pair/ctor.default.pass.cpp
@@ -15,7 +15,6 @@
// NOTE: The SFINAE on the default constructor is tested in
// default-sfinae.pass.cpp
-
#include <utility>
#include <type_traits>
#include <cassert>
@@ -23,33 +22,35 @@
#include "test_macros.h"
#include "archetypes.h"
-int main(int, char**)
-{
- {
- typedef std::pair<float, short*> P;
- P p;
- assert(p.first == 0.0f);
- assert(p.second == nullptr);
- }
+int main(int, char**) {
+ {
+ typedef std::pair<float, short*> P;
+ P p;
+ assert(p.first == 0.0f);
+ assert(p.second == nullptr);
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::pair<float, short*> P;
- constexpr P p;
- static_assert(p.first == 0.0f, "");
- static_assert(p.second == nullptr, "");
- }
- {
- using NoDefault = ImplicitTypes::NoDefault;
- using P = std::pair<int, NoDefault>;
- static_assert(!std::is_default_constructible<P>::value, "");
- using P2 = std::pair<NoDefault, int>;
- static_assert(!std::is_default_constructible<P2>::value, "");
- }
- {
- struct Base { };
- struct Derived : Base { protected: Derived() = default; };
- static_assert(!std::is_default_constructible<std::pair<Derived, int> >::value, "");
- }
+ {
+ typedef std::pair<float, short*> P;
+ constexpr P p;
+ static_assert(p.first == 0.0f, "");
+ static_assert(p.second == nullptr, "");
+ }
+ {
+ using NoDefault = ImplicitTypes::NoDefault;
+ using P = std::pair<int, NoDefault>;
+ static_assert(!std::is_default_constructible<P>::value, "");
+ using P2 = std::pair<NoDefault, int>;
+ static_assert(!std::is_default_constructible<P2>::value, "");
+ }
+ {
+ struct Base {};
+ struct Derived : Base {
+ protected:
+ Derived() = default;
+ };
+ static_assert(!std::is_default_constructible<std::pair<Derived, int> >::value, "");
+ }
#endif
return 0;
More information about the libcxx-commits
mailing list