[libcxx-commits] [libcxx] 1623261 - [libc++][NFC] Remove using declarations in common_reference.compile.pass.cpp

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 6 12:40:41 PST 2022


Author: Nikolas Klauser
Date: 2022-01-06T21:39:17+01:00
New Revision: 16232611ecad20eae845bb977d9f62192a715e34

URL: https://github.com/llvm/llvm-project/commit/16232611ecad20eae845bb977d9f62192a715e34
DIFF: https://github.com/llvm/llvm-project/commit/16232611ecad20eae845bb977d9f62192a715e34.diff

LOG: [libc++][NFC] Remove using declarations in common_reference.compile.pass.cpp

Remove using declarations in common_reference.compile.pass.cpp

Reviewed By: Quuxplusone, Mordante, #libc, jloser

Spies: jloser, libcxx-commits

Differential Revision: https://reviews.llvm.org/D116744

Added: 
    

Modified: 
    libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp
index 7e2c34b09e0cc..b18afddd5c41c 100644
--- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp
@@ -15,11 +15,6 @@
 
 #include <type_traits>
 
-using std::common_reference;
-using std::common_reference_t;
-using std::is_same_v;
-using std::void_t;
-
 template <class T>
 constexpr bool has_type = requires {
   typename T::type;
@@ -32,14 +27,12 @@ struct Tuple {};
 template <class, class, class>
 struct Tuple_helper {};
 template <class... Ts, class... Us>
-struct Tuple_helper<void_t<common_reference_t<Ts, Us>...>, Tuple<Ts...>,
-                    Tuple<Us...> > {
-  using type = Tuple<common_reference_t<Ts, Us>...>;
+struct Tuple_helper<std::void_t<std::common_reference_t<Ts, Us>...>, Tuple<Ts...>, Tuple<Us...> > {
+  using type = Tuple<std::common_reference_t<Ts, Us>...>;
 };
 
 namespace std {
-template <class... Ts, class... Us, template <class> class TQual,
-          template <class> class UQual>
+template <class... Ts, class... Us, template <class> class TQual, template <class> class UQual>
 struct basic_common_reference< ::Tuple<Ts...>, ::Tuple<Us...>, TQual, UQual>
     : ::Tuple_helper<void, Tuple<TQual<Ts>...>, Tuple<UQual<Us>...> > {};
 } // namespace std
@@ -61,25 +54,23 @@ struct common_type<Y2, X2> {
 
 // (6.1)
 //  -- If sizeof...(T) is zero, there shall be no member type.
-static_assert(!has_type<common_reference<> >);
+static_assert(!has_type<std::common_reference<> >);
 
 // (6.2)
 //  -- Otherwise, if sizeof...(T) is one, let T0 denote the sole type in the
 //     pack T. The member typedef type shall denote the same type as T0.
-static_assert(is_same_v<common_reference_t<void>, void>);
-static_assert(is_same_v<common_reference_t<int>, int>);
-static_assert(is_same_v<common_reference_t<int&>, int&>);
-static_assert(is_same_v<common_reference_t<int&&>, int&&>);
-static_assert(is_same_v<common_reference_t<int const>, int const>);
-static_assert(is_same_v<common_reference_t<int const&>, int const&>);
-static_assert(is_same_v<common_reference_t<int const&&>, int const&&>);
-static_assert(is_same_v<common_reference_t<int volatile[]>, int volatile[]>);
-static_assert(
-    is_same_v<common_reference_t<int volatile (&)[]>, int volatile (&)[]>);
-static_assert(
-    is_same_v<common_reference_t<int volatile(&&)[]>, int volatile(&&)[]>);
-static_assert(is_same_v<common_reference_t<void (&)()>, void (&)()>);
-static_assert(is_same_v<common_reference_t<void(&&)()>, void(&&)()>);
+static_assert(std::is_same_v<std::common_reference_t<void>, void>);
+static_assert(std::is_same_v<std::common_reference_t<int>, int>);
+static_assert(std::is_same_v<std::common_reference_t<int&>, int&>);
+static_assert(std::is_same_v<std::common_reference_t<int&&>, int&&>);
+static_assert(std::is_same_v<std::common_reference_t<int const>, int const>);
+static_assert(std::is_same_v<std::common_reference_t<int const&>, int const&>);
+static_assert(std::is_same_v<std::common_reference_t<int const&&>, int const&&>);
+static_assert(std::is_same_v<std::common_reference_t<int volatile[]>, int volatile[]>);
+static_assert(std::is_same_v<std::common_reference_t<int volatile (&)[]>, int volatile (&)[]>);
+static_assert(std::is_same_v<std::common_reference_t<int volatile (&&)[]>, int volatile (&&)[]>);
+static_assert(std::is_same_v<std::common_reference_t<void (&)()>, void (&)()>);
+static_assert(std::is_same_v<std::common_reference_t<void (&&)()>, void (&&)()>);
 
 // (6.3)
 //  -- Otherwise, if sizeof...(T) is two, let T1 and T2 denote the two types in
@@ -89,69 +80,59 @@ static_assert(is_same_v<common_reference_t<void(&&)()>, void(&&)()>);
 //       then the member typedef type denotes that type.
 struct B {};
 struct D : B {};
-static_assert(is_same_v<common_reference_t<B&, D&>, B&>);
-static_assert(is_same_v<common_reference_t<B const&, D&>, B const&>);
-static_assert(is_same_v<common_reference_t<B&, D const&>, B const&>);
-static_assert(is_same_v<common_reference_t<B&, D const&, D&>, B const&>);
-static_assert(is_same_v<common_reference_t<B&, D&, B&, D&>, B&>);
-
-static_assert(is_same_v<common_reference_t<B&&, D&&>, B&&>);
-static_assert(is_same_v<common_reference_t<B const&&, D&&>, B const&&>);
-static_assert(is_same_v<common_reference_t<B&&, D const&&>, B const&&>);
-static_assert(is_same_v<common_reference_t<B&, D&&>, B const&>);
-static_assert(is_same_v<common_reference_t<B&, D const&&>, B const&>);
-static_assert(is_same_v<common_reference_t<B const&, D&&>, B const&>);
-
-static_assert(is_same_v<common_reference_t<B&&, D&>, B const&>);
-static_assert(is_same_v<common_reference_t<B&&, D const&>, B const&>);
-static_assert(is_same_v<common_reference_t<B const&&, D&>, B const&>);
+static_assert(std::is_same_v<std::common_reference_t<B&, D&>, B&>);
+static_assert(std::is_same_v<std::common_reference_t<B const&, D&>, B const&>);
+static_assert(std::is_same_v<std::common_reference_t<B&, D const&>, B const&>);
+static_assert(std::is_same_v<std::common_reference_t<B&, D const&, D&>, B const&>);
+static_assert(std::is_same_v<std::common_reference_t<B&, D&, B&, D&>, B&>);
 
-static_assert(
-    is_same_v<common_reference_t<int const volatile&&, int volatile&&>,
-              int const volatile&&>);
+static_assert(std::is_same_v<std::common_reference_t<B&&, D&&>, B&&>);
+static_assert(std::is_same_v<std::common_reference_t<B const&&, D&&>, B const&&>);
+static_assert(std::is_same_v<std::common_reference_t<B&&, D const&&>, B const&&>);
+static_assert(std::is_same_v<std::common_reference_t<B&, D&&>, B const&>);
+static_assert(std::is_same_v<std::common_reference_t<B&, D const&&>, B const&>);
+static_assert(std::is_same_v<std::common_reference_t<B const&, D&&>, B const&>);
 
-static_assert(is_same_v<common_reference_t<int const&, int volatile&>,
-                        int const volatile&>);
+static_assert(std::is_same_v<std::common_reference_t<B&&, D&>, B const&>);
+static_assert(std::is_same_v<std::common_reference_t<B&&, D const&>, B const&>);
+static_assert(std::is_same_v<std::common_reference_t<B const&&, D&>, B const&>);
 
-static_assert(
-    is_same_v<common_reference_t<int (&)[10], int(&&)[10]>, int const (&)[10]>);
+static_assert(std::is_same_v<std::common_reference_t<int const&, int volatile&>, int const volatile&>);
+static_assert(std::is_same_v<std::common_reference_t<int const volatile&&, int volatile&&>, int const volatile&&>);
 
-static_assert(
-    is_same_v<common_reference_t<int const (&)[10], int volatile (&)[10]>,
-              int const volatile (&)[10]>);
+static_assert(std::is_same_v<std::common_reference_t<int (&)[10], int (&&)[10]>, int const (&)[10]>);
+static_assert(std::is_same_v<std::common_reference_t<int const (&)[10], int volatile (&)[10]>, int const volatile (&)[10]>);
 
 // (6.3.2)
 //    -- Otherwise, if basic_common_reference<remove_cvref_t<T1>,
 //       remove_cvref_t<T2>, XREF(T1), XREF(T2)>::type is well-formed, then the
 //       member typedef type denotes that type.
-static_assert(is_same_v<common_reference_t<const Tuple<int, short>&,
-                                           Tuple<int&, short volatile&> >,
-                        Tuple<const int&, const volatile short&> >);
+static_assert(std::is_same_v<std::common_reference_t<const Tuple<int, short>&, Tuple<int&, short volatile&>>,
+                             Tuple<const int&, const volatile short&>>);
 
-static_assert(is_same_v<common_reference_t<volatile Tuple<int, short>&,
-                                           const Tuple<int, short>&>,
-                        const volatile Tuple<int, short>&>);
+static_assert(std::is_same_v<std::common_reference_t<volatile Tuple<int, short>&, const Tuple<int, short>&>,
+                             const volatile Tuple<int, short>&>);
 
 // (6.3.3)
 //    -- Otherwise, if COND_RES(T1, T2) is well-formed, then the member typedef
 //       type denotes that type.
-static_assert(is_same_v<common_reference_t<void, void>, void>);
-static_assert(is_same_v<common_reference_t<int, short>, int>);
-static_assert(is_same_v<common_reference_t<int, short&>, int>);
-static_assert(is_same_v<common_reference_t<int&, short&>, int>);
-static_assert(is_same_v<common_reference_t<int&, short>, int>);
+static_assert(std::is_same_v<std::common_reference_t<void, void>, void>);
+static_assert(std::is_same_v<std::common_reference_t<int, short>, int>);
+static_assert(std::is_same_v<std::common_reference_t<int, short&>, int>);
+static_assert(std::is_same_v<std::common_reference_t<int&, short&>, int>);
+static_assert(std::is_same_v<std::common_reference_t<int&, short>, int>);
 
 // tricky volatile reference case
-static_assert(is_same_v<common_reference_t<int&&, int volatile&>, int>);
-static_assert(is_same_v<common_reference_t<int volatile&, int&&>, int>);
+static_assert(std::is_same_v<std::common_reference_t<int&&, int volatile&>, int>);
+static_assert(std::is_same_v<std::common_reference_t<int volatile&, int&&>, int>);
 
-static_assert(is_same_v<common_reference_t<int (&)[10], int (&)[11]>, int*>);
+static_assert(std::is_same_v<std::common_reference_t<int (&)[10], int (&)[11]>, int*>);
 
 // https://github.com/ericniebler/stl2/issues/338
 struct MyIntRef {
   MyIntRef(int&);
 };
-static_assert(is_same_v<common_reference_t<int&, MyIntRef>, MyIntRef>);
+static_assert(std::is_same_v<std::common_reference_t<int&, MyIntRef>, MyIntRef>);
 
 // (6.3.4)
 //    -- Otherwise, if common_type_t<T1, T2> is well-formed, then the member
@@ -163,19 +144,15 @@ struct moveonly {
 };
 struct moveonly2 : moveonly {};
 
-static_assert(
-    is_same_v<common_reference_t<moveonly const&, moveonly>, moveonly>);
-static_assert(
-    is_same_v<common_reference_t<moveonly2 const&, moveonly>, moveonly>);
-static_assert(
-    is_same_v<common_reference_t<moveonly const&, moveonly2>, moveonly>);
+static_assert(std::is_same_v<std::common_reference_t<moveonly const&, moveonly>, moveonly>);
+static_assert(std::is_same_v<std::common_reference_t<moveonly2 const&, moveonly>, moveonly>);
+static_assert(std::is_same_v<std::common_reference_t<moveonly const&, moveonly2>, moveonly>);
 
-static_assert(is_same_v<common_reference_t<X2&, Y2 const&>, Z2>);
+static_assert(std::is_same_v<std::common_reference_t<X2&, Y2 const&>, Z2>);
 
 // (6.3.5)
 //    -- Otherwise, there shall be no member type.
-static_assert(!has_type<common_reference<volatile Tuple<short>&,
-                                         const Tuple<int, short>&> >);
+static_assert(!has_type<std::common_reference<volatile Tuple<short>&, const Tuple<int, short>&> >);
 
 // (6.4)
 //  -- Otherwise, if sizeof...(T) is greater than two, let T1, T2, and Rest,
@@ -184,13 +161,12 @@ static_assert(!has_type<common_reference<volatile Tuple<short>&,
 // (6.4.1)
 //    -- If there is such a type C, the member typedef type shall denote the
 //       same type, if any, as common_reference_t<C, Rest...>.
-static_assert(is_same_v<common_reference_t<int, int, int>, int>);
-static_assert(is_same_v<common_reference_t<int&&, int const&, int volatile&>,
-                        int const volatile&>);
-static_assert(is_same_v<common_reference_t<int&&, int const&, float&>, float>);
+static_assert(std::is_same_v<std::common_reference_t<int, int, int>, int>);
+static_assert(std::is_same_v<std::common_reference_t<int&&, int const&, int volatile&>, int const volatile&>);
+static_assert(std::is_same_v<std::common_reference_t<int&&, int const&, float&>, float>);
 
 // (6.4.2)
 //    -- Otherwise, there shall be no member type.
-static_assert(!has_type<common_reference<int, short, int, char*> >);
+static_assert(!has_type<std::common_reference<int, short, int, char*> >);
 
 int main(int, char**) { return 0; }


        


More information about the libcxx-commits mailing list