[libcxx-commits] [libcxx] [libc++][NFC] Avoid opening namespace std in the tests (PR #94160)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 31 10:54:55 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

<details>
<summary>Changes</summary>

This also adds a few FIXMEs where we use UB in the tests.


---

Patch is 66.27 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/94160.diff


35 Files Affected:

- (modified) libcxx/test/libcxx/utilities/any/allocator.pass.cpp (+48-50) 
- (modified) libcxx/test/libcxx/utilities/format/enable_insertable.compile.pass.cpp (+10-14) 
- (modified) libcxx/test/std/concepts/concepts.lang/concept.common/common_with.compile.pass.cpp (+219-230) 
- (modified) libcxx/test/std/concepts/concepts.lang/concept.commonref/common_reference.compile.pass.cpp (+12-16) 
- (modified) libcxx/test/std/containers/Emplaceable.h (+1-5) 
- (modified) libcxx/test/std/containers/NotConstructible.h (+1-6) 
- (modified) libcxx/test/std/containers/container.node/node_handle.pass.cpp (+2-4) 
- (modified) libcxx/test/std/containers/unord/unord.map/compare.pass.cpp (+4-7) 
- (modified) libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp (+4-5) 
- (modified) libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp (+4-5) 
- (modified) libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp (+2-6) 
- (modified) libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp (+2-6) 
- (modified) libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/ErrorCodeEnum.pass.cpp (+2-6) 
- (modified) libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/lwg3629.pass.cpp (+2-4) 
- (modified) libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/ErrorCodeEnum.pass.cpp (+2-6) 
- (modified) libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/lwg3629.pass.cpp (+2-4) 
- (modified) libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/lwg3629.pass.cpp (+2-4) 
- (modified) libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.modifiers/lwg3629.pass.cpp (+2-4) 
- (modified) libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp (+2-3) 
- (modified) libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.readable/indirectly_readable.compile.pass.cpp (+14-14) 
- (modified) libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/user_defined_char_type.pass.cpp (+5-8) 
- (modified) libcxx/test/std/ranges/range.utility/range.subrange/ctor.range_size.pass.cpp (+2-4) 
- (modified) libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp (+1-3) 
- (modified) libcxx/test/std/time/rep.h (+4-4) 
- (modified) libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp (+1-6) 
- (modified) libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp (+1-6) 
- (modified) libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp (+3-7) 
- (modified) libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp (+16-19) 
- (modified) libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp (+1-5) 
- (modified) libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_incomplete.pass.cpp (+2-3) 
- (modified) libcxx/test/std/utilities/utility/pairs/pairs.pair/ctor.pair_like.pass.cpp (+2-6) 
- (modified) libcxx/test/std/utilities/variant/variant.hash/hash.pass.cpp (+3-8) 
- (modified) libcxx/test/std/utilities/variant/variant.visit.member/visit.pass.cpp (+1) 
- (modified) libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp (+1) 
- (modified) libcxx/test/support/Counter.h (+1-4) 


``````````diff
diff --git a/libcxx/test/libcxx/utilities/any/allocator.pass.cpp b/libcxx/test/libcxx/utilities/any/allocator.pass.cpp
index daaf74a2783fd..009a4ebed6353 100644
--- a/libcxx/test/libcxx/utilities/any/allocator.pass.cpp
+++ b/libcxx/test/libcxx/utilities/any/allocator.pass.cpp
@@ -39,61 +39,59 @@ bool Large_was_deallocated = false;
 bool Small_was_constructed = false;
 bool Small_was_destroyed = false;
 
-namespace std {
-  template <>
-  struct allocator<Large> {
-    using value_type = Large;
-    using size_type = std::size_t;
-    using difference_type = std::ptrdiff_t;
-    using propagate_on_container_move_assignment = std::true_type;
-    using is_always_equal = std::true_type;
-
-    Large* allocate(std::size_t n) {
-      Large_was_allocated = true;
-      return static_cast<Large*>(::operator new(n * sizeof(Large)));
-    }
+template <>
+struct std::allocator<Large> {
+  using value_type = Large;
+  using size_type = std::size_t;
+  using difference_type = std::ptrdiff_t;
+  using propagate_on_container_move_assignment = std::true_type;
+  using is_always_equal = std::true_type;
+
+  Large* allocate(std::size_t n) {
+    Large_was_allocated = true;
+    return static_cast<Large*>(::operator new(n * sizeof(Large)));
+  }
 
-    template <typename ...Args>
-    void construct(Large* p, Args&& ...args) {
-      new (p) Large(std::forward<Args>(args)...);
-      Large_was_constructed = true;
-    }
+  template <typename ...Args>
+  void construct(Large* p, Args&& ...args) {
+    new (p) Large(std::forward<Args>(args)...);
+    Large_was_constructed = true;
+  }
 
-    void destroy(Large* p) {
-      p->~Large();
-      Large_was_destroyed = true;
-    }
+  void destroy(Large* p) {
+    p->~Large();
+    Large_was_destroyed = true;
+  }
 
-    void deallocate(Large* p, std::size_t) {
-      Large_was_deallocated = true;
-      return ::operator delete(p);
-    }
-  };
-
-  template <>
-  struct allocator<Small> {
-    using value_type = Small;
-    using size_type = std::size_t;
-    using difference_type = std::ptrdiff_t;
-    using propagate_on_container_move_assignment = std::true_type;
-    using is_always_equal = std::true_type;
-
-    Small* allocate(std::size_t) { assert(false); return nullptr; }
-
-    template <typename ...Args>
-    void construct(Small* p, Args&& ...args) {
-      new (p) Small(std::forward<Args>(args)...);
-      Small_was_constructed = true;
-    }
+  void deallocate(Large* p, std::size_t) {
+    Large_was_deallocated = true;
+    return ::operator delete(p);
+  }
+};
+
+template <>
+struct std::allocator<Small> {
+  using value_type = Small;
+  using size_type = std::size_t;
+  using difference_type = std::ptrdiff_t;
+  using propagate_on_container_move_assignment = std::true_type;
+  using is_always_equal = std::true_type;
+
+  Small* allocate(std::size_t) { assert(false); return nullptr; }
+
+  template <typename ...Args>
+  void construct(Small* p, Args&& ...args) {
+    new (p) Small(std::forward<Args>(args)...);
+    Small_was_constructed = true;
+  }
 
-    void destroy(Small* p) {
-      p->~Small();
-      Small_was_destroyed = true;
-    }
+  void destroy(Small* p) {
+    p->~Small();
+    Small_was_destroyed = true;
+  }
 
-    void deallocate(Small*, std::size_t) { assert(false); }
-  };
-} // end namespace std
+  void deallocate(Small*, std::size_t) { assert(false); }
+};
 
 
 int main(int, char**) {
diff --git a/libcxx/test/libcxx/utilities/format/enable_insertable.compile.pass.cpp b/libcxx/test/libcxx/utilities/format/enable_insertable.compile.pass.cpp
index 5c100322fbcf3..9790aeff189e7 100644
--- a/libcxx/test/libcxx/utilities/format/enable_insertable.compile.pass.cpp
+++ b/libcxx/test/libcxx/utilities/format/enable_insertable.compile.pass.cpp
@@ -61,26 +61,24 @@ struct valid {
   void insert(iterator, CharT*, CharT*);
 };
 
-namespace std::__format {
 template <>
-inline constexpr bool __enable_insertable<no_value_type<char>> = true;
+inline constexpr bool std::__format::__enable_insertable<no_value_type<char>> = true;
 template <>
-inline constexpr bool __enable_insertable<no_end<char>> = true;
+inline constexpr bool std::__format::__enable_insertable<no_end<char>> = true;
 template <>
-inline constexpr bool __enable_insertable<no_insert<char>> = true;
+inline constexpr bool std::__format::__enable_insertable<no_insert<char>> = true;
 template <>
-inline constexpr bool __enable_insertable<valid<char>> = true;
+inline constexpr bool std::__format::__enable_insertable<valid<char>> = true;
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
 template <>
-inline constexpr bool __enable_insertable<no_value_type<wchar_t>> = true;
+inline constexpr bool std::__format::__enable_insertable<no_value_type<wchar_t>> = true;
 template <>
-inline constexpr bool __enable_insertable<no_end<wchar_t>> = true;
+inline constexpr bool std::__format::__enable_insertable<no_end<wchar_t>> = true;
 template <>
-inline constexpr bool __enable_insertable<no_insert<wchar_t>> = true;
+inline constexpr bool std::__format::__enable_insertable<no_insert<wchar_t>> = true;
 template <>
-inline constexpr bool __enable_insertable<valid<wchar_t>> = true;
+inline constexpr bool std::__format::__enable_insertable<valid<wchar_t>> = true;
 #endif
-} // namespace std::__format
 
 static_assert(!std::__format::__insertable<no_value_type<char>>);
 static_assert(!std::__format::__insertable<no_end<char>>);
@@ -95,12 +93,10 @@ static_assert(!std::__format::__insertable<no_specialization<wchar_t>>);
 static_assert(std::__format::__insertable<valid<wchar_t>>);
 #endif
 
-namespace std::__format {
 template <>
-inline constexpr bool __enable_insertable<valid<signed char>> = true;
+inline constexpr bool std::__format::__enable_insertable<valid<signed char>> = true;
 template <>
-inline constexpr bool __enable_insertable<valid<unsigned char>> = true;
-} // namespace std::__format
+inline constexpr bool std::__format::__enable_insertable<valid<unsigned char>> = true;
 
 static_assert(!std::__format::__insertable<valid<signed char>>);
 static_assert(!std::__format::__insertable<valid<unsigned char>>);
diff --git a/libcxx/test/std/concepts/concepts.lang/concept.common/common_with.compile.pass.cpp b/libcxx/test/std/concepts/concepts.lang/concept.common/common_with.compile.pass.cpp
index 5d80c1cba2655..91d060e37f098 100644
--- a/libcxx/test/std/concepts/concepts.lang/concept.common/common_with.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.lang/concept.common/common_with.compile.pass.cpp
@@ -262,17 +262,16 @@ struct BadBasicCommonType {
   // should be placed so the test doesn't get deleted.
 };
 
-namespace std {
 template <>
-struct common_type<BadBasicCommonType, int> {
+struct std::common_type<BadBasicCommonType, int> {
   using type = BadBasicCommonType;
 };
 
 template <>
-struct common_type<int, BadBasicCommonType> {
+struct std::common_type<int, BadBasicCommonType> {
   using type = int;
 };
-} // namespace std
+
 static_assert(requires {
   typename std::common_type_t<BadBasicCommonType, int>;
 });
@@ -289,17 +288,16 @@ static_assert(!std::convertible_to<DullCommonType, int>);
 struct T1 {};
 static_assert(!std::convertible_to<DullCommonType, T1>);
 
-namespace std {
 template <>
-struct common_type<T1, int> {
+struct std::common_type<T1, int> {
   using type = DullCommonType;
 };
 
 template <>
-struct common_type<int, T1> {
+struct std::common_type<int, T1> {
   using type = DullCommonType;
 };
-} // namespace std
+
 static_assert(HasValidCommonType<T1, int>());
 static_assert(!CheckCommonWith<T1, int>());
 
@@ -314,17 +312,16 @@ struct T2 {};
 static_assert(
     !std::convertible_to<CommonTypeImplicitlyConstructibleFromInt, T2>);
 
-namespace std {
 template <>
-struct common_type<T2, int> {
+struct std::common_type<T2, int> {
   using type = CommonTypeImplicitlyConstructibleFromInt;
 };
 
 template <>
-struct common_type<int, T2> {
+struct std::common_type<int, T2> {
   using type = CommonTypeImplicitlyConstructibleFromInt;
 };
-} // namespace std
+
 static_assert(HasValidCommonType<T2, int>());
 static_assert(!CheckCommonWith<T2, int>());
 
@@ -339,17 +336,16 @@ struct T3 {};
 static_assert(
     !std::convertible_to<CommonTypeExplicitlyConstructibleFromInt, T2>);
 
-namespace std {
 template <>
-struct common_type<T3, int> {
+struct std::common_type<T3, int> {
   using type = CommonTypeExplicitlyConstructibleFromInt;
 };
 
 template <>
-struct common_type<int, T3> {
+struct std::common_type<int, T3> {
   using type = CommonTypeExplicitlyConstructibleFromInt;
 };
-} // namespace std
+
 static_assert(HasValidCommonType<T3, int>());
 static_assert(!CheckCommonWith<T3, int>());
 
@@ -361,17 +357,16 @@ static_assert(requires(T4 t4) {
   static_cast<CommonTypeImplicitlyConstructibleFromT4>(t4);
 });
 
-namespace std {
 template <>
-struct common_type<T4, int> {
+struct std::common_type<T4, int> {
   using type = CommonTypeImplicitlyConstructibleFromT4;
 };
 
 template <>
-struct common_type<int, T4> {
+struct std::common_type<int, T4> {
   using type = CommonTypeImplicitlyConstructibleFromT4;
 };
-} // namespace std
+
 static_assert(HasValidCommonType<T4, int>());
 static_assert(!CheckCommonWith<T4, int>());
 
@@ -383,17 +378,16 @@ static_assert(requires(T5 t5) {
   static_cast<CommonTypeExplicitlyConstructibleFromT5>(t5);
 });
 
-namespace std {
 template <>
-struct common_type<T5, int> {
+struct std::common_type<T5, int> {
   using type = CommonTypeExplicitlyConstructibleFromT5;
 };
 
 template <>
-struct common_type<int, T5> {
+struct std::common_type<int, T5> {
   using type = CommonTypeExplicitlyConstructibleFromT5;
 };
-} // namespace std
+
 static_assert(HasValidCommonType<T5, int>());
 static_assert(!CheckCommonWith<T5, int>());
 
@@ -403,113 +397,111 @@ struct CommonTypeNoCommonReference {
   CommonTypeNoCommonReference(int);
 };
 
-namespace std {
 template <>
-struct common_type<T6, int> {
+struct std::common_type<T6, int> {
   using type = CommonTypeNoCommonReference;
 };
 
 template <>
-struct common_type<int, T6> {
+struct std::common_type<int, T6> {
   using type = CommonTypeNoCommonReference;
 };
 
 template <>
-struct common_type<T6&, int&> {};
+struct std::common_type<T6&, int&> {};
 
 template <>
-struct common_type<int&, T6&> {};
+struct std::common_type<int&, T6&> {};
 
 template <>
-struct common_type<T6&, const int&> {};
+struct std::common_type<T6&, const int&> {};
 
 template <>
-struct common_type<int&, const T6&> {};
+struct std::common_type<int&, const T6&> {};
 
 template <>
-struct common_type<T6&, volatile int&> {};
+struct std::common_type<T6&, volatile int&> {};
 
 template <>
-struct common_type<int&, volatile T6&> {};
+struct std::common_type<int&, volatile T6&> {};
 
 template <>
-struct common_type<T6&, const volatile int&> {};
+struct std::common_type<T6&, const volatile int&> {};
 
 template <>
-struct common_type<int&, const volatile T6&> {};
+struct std::common_type<int&, const volatile T6&> {};
 
 template <>
-struct common_type<const T6&, int&> {};
+struct std::common_type<const T6&, int&> {};
 
 template <>
-struct common_type<const int&, T6&> {};
+struct std::common_type<const int&, T6&> {};
 
 template <>
-struct common_type<const T6&, const int&> {};
+struct std::common_type<const T6&, const int&> {};
 
 template <>
-struct common_type<const int&, const T6&> {};
+struct std::common_type<const int&, const T6&> {};
 
 template <>
-struct common_type<const T6&, volatile int&> {};
+struct std::common_type<const T6&, volatile int&> {};
 
 template <>
-struct common_type<const int&, volatile T6&> {};
+struct std::common_type<const int&, volatile T6&> {};
 
 template <>
-struct common_type<const T6&, const volatile int&> {};
+struct std::common_type<const T6&, const volatile int&> {};
 
 template <>
-struct common_type<const int&, const volatile T6&> {};
+struct std::common_type<const int&, const volatile T6&> {};
 
 template <>
-struct common_type<volatile T6&, int&> {};
+struct std::common_type<volatile T6&, int&> {};
 
 template <>
-struct common_type<volatile int&, T6&> {};
+struct std::common_type<volatile int&, T6&> {};
 
 template <>
-struct common_type<volatile T6&, const int&> {};
+struct std::common_type<volatile T6&, const int&> {};
 
 template <>
-struct common_type<volatile int&, const T6&> {};
+struct std::common_type<volatile int&, const T6&> {};
 
 template <>
-struct common_type<volatile T6&, volatile int&> {};
+struct std::common_type<volatile T6&, volatile int&> {};
 
 template <>
-struct common_type<volatile int&, volatile T6&> {};
+struct std::common_type<volatile int&, volatile T6&> {};
 
 template <>
-struct common_type<volatile T6&, const volatile int&> {};
+struct std::common_type<volatile T6&, const volatile int&> {};
 
 template <>
-struct common_type<volatile int&, const volatile T6&> {};
+struct std::common_type<volatile int&, const volatile T6&> {};
 
 template <>
-struct common_type<const volatile T6&, int&> {};
+struct std::common_type<const volatile T6&, int&> {};
 
 template <>
-struct common_type<const volatile int&, T6&> {};
+struct std::common_type<const volatile int&, T6&> {};
 
 template <>
-struct common_type<const volatile T6&, const int&> {};
+struct std::common_type<const volatile T6&, const int&> {};
 
 template <>
-struct common_type<const volatile int&, const T6&> {};
+struct std::common_type<const volatile int&, const T6&> {};
 
 template <>
-struct common_type<const volatile T6&, volatile int&> {};
+struct std::common_type<const volatile T6&, volatile int&> {};
 
 template <>
-struct common_type<const volatile int&, volatile T6&> {};
+struct std::common_type<const volatile int&, volatile T6&> {};
 
 template <>
-struct common_type<const volatile T6&, const volatile int&> {};
+struct std::common_type<const volatile T6&, const volatile int&> {};
 
 template <>
-struct common_type<const volatile int&, const volatile T6&> {};
-} // namespace std
+struct std::common_type<const volatile int&, const volatile T6&> {};
 
 template <typename T, typename U>
 constexpr bool HasCommonReference() noexcept {
@@ -526,177 +518,176 @@ struct CommonTypeNoMetaCommonReference {
   CommonTypeNoMetaCommonReference(int);
 };
 
-namespace std {
 template <>
-struct common_type<T7, int> {
+struct std::common_type<T7, int> {
   using type = CommonTypeNoMetaCommonReference;
 };
 
 template <>
-struct common_type<int, T7> {
+struct std::common_type<int, T7> {
   using type = CommonTypeNoMetaCommonReference;
 };
 
 template <>
-struct common_type<T7&, int&> {
+struct std::common_type<T7&, int&> {
   using type = void;
 };
 
 template <>
-struct common_type<int&, T7&> {
+struct std::common_type<int&, T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<T7&, const int&> {
+struct std::common_type<T7&, const int&> {
   using type = void;
 };
 
 template <>
-struct common_type<int&, const T7&> {
+struct std::common_type<int&, const T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<T7&, volatile int&> {
+struct std::common_type<T7&, volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<int&, volatile T7&> {
+struct std::common_type<int&, volatile T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<T7&, const volatile int&> {
+struct std::common_type<T7&, const volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<int&, const volatile T7&> {
+struct std::common_type<int&, const volatile T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const T7&, int&> {
+struct std::common_type<const T7&, int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const int&, T7&> {
+struct std::common_type<const int&, T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const T7&, const int&> {
+struct std::common_type<const T7&, const int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const int&, const T7&> {
+struct std::common_type<const int&, const T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const T7&, volatile int&> {
+struct std::common_type<const T7&, volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const int&, volatile T7&> {
+struct std::common_type<const int&, volatile T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const T7&, const volatile int&> {
+struct std::common_type<const T7&, const volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const int&, const volatile T7&> {
+struct std::common_type<const int&, const volatile T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile T7&, int&> {
+struct std::common_type<volatile T7&, int&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile int&, T7&> {
+struct std::common_type<volatile int&, T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile T7&, const int&> {
+struct std::common_type<volatile T7&, const int&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile int&, const T7&> {
+struct std::common_type<volatile int&, const T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile T7&, volatile int&> {
+struct std::common_type<volatile T7&, volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile int&, volatile T7&> {
+struct std::common_type<volatile int&, volatile T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile T7&, const volatile int&> {
+struct std::common_type<volatile T7&, const volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile int&, const volatile T7&> {
+struct std::common_type<volatile int&, const volatile T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile T7&, int&> {
+struct std::common_type<const volatile T7&, int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile int&, T7&> {
+struct std::common_type<const volatile int&, T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile T7&, const int&> {
+struct std::common_type<const volatile T7&, const int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile int&, const T7&> {
+struct std::common_type<const volatile int&, const T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile T7&, volatile int&> {
+struct std::common_type<const volatile T7&, volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile int&, volatile T7&> {
+struct std::common_type<const volatile int&, volatile T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile T7&, const volatile int&> {
+struct std::common_type<const volatile T7&, const volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile int&, const volatile T7&> {
+struct std::common_type<const volatile int&, const volatile T7&> {
   using type = void;
 };
-} // namespace std
+
 static_assert(HasValidCommonType<T7, int>());
 static_assert(HasValidCommonType<const T7&, const int&>());
 static_assert(HasCommonReference<const T7&, const int&>());
@@ -709,284 +700,282 @@ struct CommonWithInt {
   operator int() const volatile;
 };
 
-namespace std {
 template <>
-struct common_type<CommonWithInt, int> {
+struct std::common_type<CommonWithInt, int> {
   using type = int;
 };
 
 template <>
-struct common_type<int, CommonWithInt> : common_type<CommonWithInt, int> {};
+struct std::common_type<int, CommonWithInt> : std::common_type<CommonWithInt, int> {};
 
 template <>
-struct common_type<CommonWithInt&, int&> : common_type<CommonWithInt, int> {};
+struct std::common_type<CommonWithInt&, int&> : std::common_type<CommonWithInt, int> {};
 
 template <>
-struct common_type<int&, CommonWithInt&> : common_type<CommonWithInt, int> {};
+struct std::common_type<int&, CommonWithInt&> : std::common_type<CommonWithInt, int> {};
 
 template <>
-struct common_type<CommonWithInt&, const int&>
-    : common_type<CommonWithInt, int> {};
+struct std::common_type<CommonWithInt&, const int&>
+    : std::common_type<CommonWithInt, int> {};
 
 template <>
-struct common_type<int&, const CommonWithInt&>
-    : common_type<CommonWithInt, int> {};
+struct std::common_type<int&, const CommonWithInt&>
+    : std::common_type<CommonWithInt, int> {};
 
 template <>
-struct common_type<CommonWithInt&, volatile int&>
-    : common_type<CommonWithInt, ...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/94160


More information about the libcxx-commits mailing list