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 --- 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 -using std::common_reference; -using std::common_reference_t; -using std::is_same_v; -using std::void_t; - template constexpr bool has_type = requires { typename T::type; @@ -32,14 +27,12 @@ template struct Tuple_helper {}; template -struct Tuple_helper...>, Tuple, - Tuple > { - using type = Tuple...>; +struct Tuple_helper...>, Tuple, Tuple > { + using type = Tuple...>; }; namespace std { -template class TQual, - template class UQual> +template class TQual, template class UQual> struct basic_common_reference< ::Tuple, ::Tuple, TQual, UQual> : ::Tuple_helper...>, Tuple...> > {}; } // namespace std @@ -61,25 +54,23 @@ // (6.1) // -- If sizeof...(T) is zero, there shall be no member type. -static_assert(!has_type >); +static_assert(!has_type >); // (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, void>); -static_assert(is_same_v, int>); -static_assert(is_same_v, int&>); -static_assert(is_same_v, int&&>); -static_assert(is_same_v, int const>); -static_assert(is_same_v, int const&>); -static_assert(is_same_v, int const&&>); -static_assert(is_same_v, int volatile[]>); -static_assert( - is_same_v, int volatile (&)[]>); -static_assert( - is_same_v, int volatile(&&)[]>); -static_assert(is_same_v, void (&)()>); -static_assert(is_same_v, void(&&)()>); +static_assert(std::is_same_v, void>); +static_assert(std::is_same_v, int>); +static_assert(std::is_same_v, int&>); +static_assert(std::is_same_v, int&&>); +static_assert(std::is_same_v, int const>); +static_assert(std::is_same_v, int const&>); +static_assert(std::is_same_v, int const&&>); +static_assert(std::is_same_v, int volatile[]>); +static_assert(std::is_same_v, int volatile (&)[]>); +static_assert(std::is_same_v, int volatile (&&)[]>); +static_assert(std::is_same_v, void (&)()>); +static_assert(std::is_same_v, void (&&)()>); // (6.3) // -- Otherwise, if sizeof...(T) is two, let T1 and T2 denote the two types in @@ -89,69 +80,60 @@ // then the member typedef type denotes that type. struct B {}; struct D : B {}; -static_assert(is_same_v, B&>); -static_assert(is_same_v, B const&>); -static_assert(is_same_v, B const&>); -static_assert(is_same_v, B const&>); -static_assert(is_same_v, B&>); - -static_assert(is_same_v, B&&>); -static_assert(is_same_v, B const&&>); -static_assert(is_same_v, B const&&>); -static_assert(is_same_v, B const&>); -static_assert(is_same_v, B const&>); -static_assert(is_same_v, B const&>); - -static_assert(is_same_v, B const&>); -static_assert(is_same_v, B const&>); -static_assert(is_same_v, B const&>); - -static_assert( - is_same_v, - int const volatile&&>); - -static_assert(is_same_v, - int const volatile&>); - -static_assert( - is_same_v, int const (&)[10]>); - +static_assert(std::is_same_v, B&>); +static_assert(std::is_same_v, B const&>); +static_assert(std::is_same_v, B const&>); +static_assert(std::is_same_v, B const&>); +static_assert(std::is_same_v, B&>); + +static_assert(std::is_same_v, B&&>); +static_assert(std::is_same_v, B const&&>); +static_assert(std::is_same_v, B const&&>); +static_assert(std::is_same_v, B const&>); +static_assert(std::is_same_v, B const&>); +static_assert(std::is_same_v, B const&>); + +static_assert(std::is_same_v, B const&>); +static_assert(std::is_same_v, B const&>); +static_assert(std::is_same_v, B const&>); + +static_assert(std::is_same_v, int const volatile&>); +static_assert(std::is_same_v, int const volatile&&>); + +static_assert(std::is_same_v, int const (&)[10]>); static_assert( - is_same_v, - int const volatile (&)[10]>); + std::is_same_v, int const volatile (&)[10]>); // (6.3.2) // -- Otherwise, if basic_common_reference, // remove_cvref_t, XREF(T1), XREF(T2)>::type is well-formed, then the // member typedef type denotes that type. -static_assert(is_same_v&, - Tuple >, - Tuple >); +static_assert(std::is_same_v&, Tuple>, + Tuple>); -static_assert(is_same_v&, - const Tuple&>, - const volatile Tuple&>); +static_assert(std::is_same_v&, const Tuple&>, + const volatile Tuple&>); // (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, void>); -static_assert(is_same_v, int>); -static_assert(is_same_v, int>); -static_assert(is_same_v, int>); -static_assert(is_same_v, int>); +static_assert(std::is_same_v, void>); +static_assert(std::is_same_v, int>); +static_assert(std::is_same_v, int>); +static_assert(std::is_same_v, int>); +static_assert(std::is_same_v, int>); // tricky volatile reference case -static_assert(is_same_v, int>); -static_assert(is_same_v, int>); +static_assert(std::is_same_v, int>); +static_assert(std::is_same_v, int>); -static_assert(is_same_v, int*>); +static_assert(std::is_same_v, int*>); // https://github.com/ericniebler/stl2/issues/338 struct MyIntRef { MyIntRef(int&); }; -static_assert(is_same_v, MyIntRef>); +static_assert(std::is_same_v, MyIntRef>); // (6.3.4) // -- Otherwise, if common_type_t is well-formed, then the member @@ -163,19 +145,15 @@ }; struct moveonly2 : moveonly {}; -static_assert( - is_same_v, moveonly>); -static_assert( - is_same_v, moveonly>); -static_assert( - is_same_v, moveonly>); +static_assert(std::is_same_v, moveonly>); +static_assert(std::is_same_v, moveonly>); +static_assert(std::is_same_v, moveonly>); -static_assert(is_same_v, Z2>); +static_assert(std::is_same_v, Z2>); // (6.3.5) // -- Otherwise, there shall be no member type. -static_assert(!has_type&, - const Tuple&> >); +static_assert(!has_type&, const Tuple&> >); // (6.4) // -- Otherwise, if sizeof...(T) is greater than two, let T1, T2, and Rest, @@ -184,13 +162,12 @@ // (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. -static_assert(is_same_v, int>); -static_assert(is_same_v, - int const volatile&>); -static_assert(is_same_v, float>); +static_assert(std::is_same_v, int>); +static_assert(std::is_same_v, int const volatile&>); +static_assert(std::is_same_v, float>); // (6.4.2) // -- Otherwise, there shall be no member type. -static_assert(!has_type >); +static_assert(!has_type >); int main(int, char**) { return 0; }