diff options
Diffstat (limited to 'test/std/utilities/meta')
13 files changed, 330 insertions, 107 deletions
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp index 61523e4872d46..85b14726617f8 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp @@ -37,8 +37,16 @@ namespace std typedef S<T> type; }; +// P0548 + template <class T> + struct common_type< ::S<T>, ::S<T> > { + typedef S<T> type; + }; + template <> struct common_type< ::S<long>, long> {}; template <> struct common_type<long, ::S<long> > {}; + template <> struct common_type< ::X<float> > {}; + template <> struct common_type< ::X<double>, ::X<double> > {}; } #if TEST_STD_VER >= 11 @@ -88,6 +96,9 @@ void test_bullet_two() { static_assert(std::is_same<CommonType<int const>, int>::value, ""); static_assert(std::is_same<CommonType<int volatile[]>, int volatile*>::value, ""); static_assert(std::is_same<CommonType<void(&)()>, void(*)()>::value, ""); + + static_assert(no_common_type<X<float> >::value, ""); + static_assert(no_common_type<X<double> >::value, ""); } template <class T, class U, class Expect> @@ -284,4 +295,18 @@ int main() test_bullet_three_two(); test_bullet_four(); #endif + +// P0548 + static_assert((std::is_same<std::common_type<S<int> >::type, S<int> >::value), ""); + static_assert((std::is_same<std::common_type<S<int>, S<int> >::type, S<int> >::value), ""); + + static_assert((std::is_same<std::common_type<int>::type, int>::value), ""); + static_assert((std::is_same<std::common_type<const int>::type, int>::value), ""); + static_assert((std::is_same<std::common_type<volatile int>::type, int>::value), ""); + static_assert((std::is_same<std::common_type<const volatile int>::type, int>::value), ""); + + static_assert((std::is_same<std::common_type<int, int>::type, int>::value), ""); + static_assert((std::is_same<std::common_type<const int, int>::type, int>::value), ""); + static_assert((std::is_same<std::common_type<int, const int>::type, int>::value), ""); + static_assert((std::is_same<std::common_type<const int, const int>::type, int>::value), ""); } diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp index bcd8398494533..4f45a0340a916 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp @@ -33,4 +33,10 @@ int main() test_decay<int[3], int*>(); test_decay<const int[3], const int*>(); test_decay<void(), void (*)()>(); +#if TEST_STD_VER > 11 + test_decay<int(int) const, int(int) const>(); + test_decay<int(int) volatile, int(int) volatile>(); + test_decay<int(int) &, int(int) &>(); + test_decay<int(int) &&, int(int) &&>(); +#endif } diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp index 8cb5853bbc6d7..eac4e4a089fed 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp @@ -26,7 +26,6 @@ struct wat struct F {}; struct FD : public F {}; -struct NotDerived {}; template <class T, class U> void test_result_of_imp() @@ -43,7 +42,6 @@ void test_result_of_imp() int main() { - typedef NotDerived ND; { typedef char F::*PMD; test_result_of_imp<PMD(F &), char &>(); diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp index 410e47e03bcc2..b00798b72240c 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp @@ -17,24 +17,32 @@ #include "test_macros.h" enum E { V = INT_MIN }; -enum F { W = UINT_MAX }; -int main() -{ #if !defined(_WIN32) || defined(__MINGW32__) - typedef unsigned ExpectUnsigned; + #define TEST_UNSIGNED_UNDERLYING_TYPE 1 #else - typedef int ExpectUnsigned; // MSVC's ABI doesn't follow the Standard + #define TEST_UNSIGNED_UNDERLYING_TYPE 0 // MSVC's ABI doesn't follow the Standard #endif + +#if TEST_UNSIGNED_UNDERLYING_TYPE +enum F { W = UINT_MAX }; +#endif // TEST_UNSIGNED_UNDERLYING_TYPE + +int main() +{ static_assert((std::is_same<std::underlying_type<E>::type, int>::value), "E has the wrong underlying type"); - static_assert((std::is_same<std::underlying_type<F>::type, ExpectUnsigned>::value), +#if TEST_UNSIGNED_UNDERLYING_TYPE + static_assert((std::is_same<std::underlying_type<F>::type, unsigned>::value), "F has the wrong underlying type"); +#endif // TEST_UNSIGNED_UNDERLYING_TYPE #if TEST_STD_VER > 11 static_assert((std::is_same<std::underlying_type_t<E>, int>::value), ""); - static_assert((std::is_same<std::underlying_type_t<F>, ExpectUnsigned>::value), ""); -#endif +#if TEST_UNSIGNED_UNDERLYING_TYPE + static_assert((std::is_same<std::underlying_type_t<F>, unsigned>::value), ""); +#endif // TEST_UNSIGNED_UNDERLYING_TYPE +#endif // TEST_STD_VER > 11 #if TEST_STD_VER >= 11 enum G : char { }; @@ -43,6 +51,6 @@ int main() "G has the wrong underlying type"); #if TEST_STD_VER > 11 static_assert((std::is_same<std::underlying_type_t<G>, char>::value), ""); -#endif +#endif // TEST_STD_VER > 11 #endif // TEST_STD_VER >= 11 } diff --git a/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp b/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp index 05ef99d0ebf4d..2d10fb0040a7e 100644 --- a/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp +++ b/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp @@ -13,7 +13,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: gcc-5.1 gcc-5.2 +// XFAIL: gcc-5.1, gcc-5.2 #include <type_traits> diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp index 32e4f06beb04e..c340ba69cda3c 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp @@ -13,6 +13,7 @@ #include <type_traits> #include <cstddef> // for std::nullptr_t + #include "test_macros.h" template <class T> @@ -79,22 +80,27 @@ int main() test_is_function<int(Abstract *)>(); test_is_function<void(...)>(); - test_is_not_function<std::nullptr_t>(); - test_is_not_function<void>(); - test_is_not_function<int>(); - test_is_not_function<int&>(); - test_is_not_function<int&&>(); - test_is_not_function<int*>(); - test_is_not_function<double>(); - test_is_not_function<char[3]>(); - test_is_not_function<char[]>(); - test_is_not_function<Union>(); - test_is_not_function<Enum>(); - test_is_not_function<FunctionPtr>(); // function pointer is not a function - test_is_not_function<Empty>(); - test_is_not_function<bit_zero>(); - test_is_not_function<NotEmpty>(); - test_is_not_function<Abstract>(); - test_is_not_function<Abstract*>(); - test_is_not_function<incomplete_type>(); + test_is_not_function<std::nullptr_t>(); + test_is_not_function<void>(); + test_is_not_function<int>(); + test_is_not_function<int&>(); + test_is_not_function<int&&>(); + test_is_not_function<int*>(); + test_is_not_function<double>(); + test_is_not_function<char[3]>(); + test_is_not_function<char[]>(); + test_is_not_function<Union>(); + test_is_not_function<Enum>(); + test_is_not_function<FunctionPtr>(); // function pointer is not a function + test_is_not_function<Empty>(); + test_is_not_function<bit_zero>(); + test_is_not_function<NotEmpty>(); + test_is_not_function<Abstract>(); + test_is_not_function<Abstract*>(); + test_is_not_function<incomplete_type>(); + +#if TEST_STD_VER >= 11 + test_is_function<void() noexcept>(); + test_is_function<void() const && noexcept>(); +#endif } diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp index d4043f48f98ed..a63a88c4d18bd 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp @@ -97,4 +97,10 @@ int main() test_is_not_member_pointer<NotEmpty>(); test_is_not_member_pointer<Abstract>(); test_is_not_member_pointer<incomplete_type>(); + +#if TEST_STD_VER >= 11 + test_is_member_pointer<int (Empty::*)(int, ...) const>(); + test_is_member_pointer<int (Empty::*)(int, long, long) const noexcept>(); + test_is_member_pointer<int (Empty::*)() & noexcept>(); +#endif } diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp index a895a8d447b66..691c549b5e78b 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp @@ -52,90 +52,175 @@ struct incomplete_type; int main() { - test_member_function_pointer<void (Class::*)()>(); - test_member_function_pointer<void (Class::*)(int)>(); - test_member_function_pointer<void (Class::*)(int, char)>(); + test_member_function_pointer<void (Class::*)()>(); + test_member_function_pointer<void (Class::*)(int)>(); + test_member_function_pointer<void (Class::*)(int, char)>(); - test_member_function_pointer<void (Class::*)() const>(); - test_member_function_pointer<void (Class::*)(int) const>(); - test_member_function_pointer<void (Class::*)(int, char) const>(); + test_member_function_pointer<void (Class::*)() const>(); + test_member_function_pointer<void (Class::*)(int) const>(); + test_member_function_pointer<void (Class::*)(int, char) const>(); - test_member_function_pointer<void (Class::*)() volatile>(); - test_member_function_pointer<void (Class::*)(int) volatile>(); - test_member_function_pointer<void (Class::*)(int, char) volatile>(); + test_member_function_pointer<void (Class::*)() volatile>(); + test_member_function_pointer<void (Class::*)(int) volatile>(); + test_member_function_pointer<void (Class::*)(int, char) volatile>(); - test_member_function_pointer<void (Class::*)(...)>(); - test_member_function_pointer<void (Class::*)(int, ...)>(); - test_member_function_pointer<void (Class::*)(int, char, ...)>(); + test_member_function_pointer<void (Class::*)(...)>(); + test_member_function_pointer<void (Class::*)(int, ...)>(); + test_member_function_pointer<void (Class::*)(int, char, ...)>(); - test_member_function_pointer<void (Class::*)(...) const>(); - test_member_function_pointer<void (Class::*)(int, ...) const>(); - test_member_function_pointer<void (Class::*)(int, char, ...) const>(); + test_member_function_pointer<void (Class::*)(...) const>(); + test_member_function_pointer<void (Class::*)(int, ...) const>(); + test_member_function_pointer<void (Class::*)(int, char, ...) const>(); + + test_member_function_pointer<void (Class::*)(...) volatile>(); + test_member_function_pointer<void (Class::*)(int, ...) volatile>(); + test_member_function_pointer<void (Class::*)(int, char, ...) volatile>(); - test_member_function_pointer<void (Class::*)(...) volatile>(); - test_member_function_pointer<void (Class::*)(int, ...) volatile>(); - test_member_function_pointer<void (Class::*)(int, char, ...) volatile>(); // reference qualifiers on functions are a C++11 extension #if TEST_STD_VER >= 11 - test_member_function_pointer<void (Class::*)() &>(); - test_member_function_pointer<void (Class::*)(int) &>(); - test_member_function_pointer<void (Class::*)(int, char) &>(); - test_member_function_pointer<void (Class::*)(...) &>(); - test_member_function_pointer<void (Class::*)(int,...) &>(); - test_member_function_pointer<void (Class::*)(int, char,...) &>(); - - test_member_function_pointer<void (Class::*)() const &>(); - test_member_function_pointer<void (Class::*)(int) const &>(); - test_member_function_pointer<void (Class::*)(int, char) const &>(); - test_member_function_pointer<void (Class::*)(...) const &>(); - test_member_function_pointer<void (Class::*)(int,...) const &>(); - test_member_function_pointer<void (Class::*)(int, char,...) const &>(); - - test_member_function_pointer<void (Class::*)() volatile &>(); - test_member_function_pointer<void (Class::*)(int) volatile &>(); - test_member_function_pointer<void (Class::*)(int, char) volatile &>(); - test_member_function_pointer<void (Class::*)(...) volatile &>(); - test_member_function_pointer<void (Class::*)(int,...) volatile &>(); - test_member_function_pointer<void (Class::*)(int, char,...) volatile &>(); - - test_member_function_pointer<void (Class::*)() const volatile &>(); - test_member_function_pointer<void (Class::*)(int) const volatile &>(); - test_member_function_pointer<void (Class::*)(int, char) const volatile &>(); - test_member_function_pointer<void (Class::*)(...) const volatile &>(); - test_member_function_pointer<void (Class::*)(int,...) const volatile &>(); - test_member_function_pointer<void (Class::*)(int, char,...) const volatile &>(); - - // RValue qualifiers - test_member_function_pointer<void (Class::*)() &&>(); - test_member_function_pointer<void (Class::*)(int) &&>(); - test_member_function_pointer<void (Class::*)(int, char) &&>(); - test_member_function_pointer<void (Class::*)(...) &&>(); - test_member_function_pointer<void (Class::*)(int,...) &&>(); - test_member_function_pointer<void (Class::*)(int, char,...) &&>(); - - test_member_function_pointer<void (Class::*)() const &&>(); - test_member_function_pointer<void (Class::*)(int) const &&>(); - test_member_function_pointer<void (Class::*)(int, char) const &&>(); - test_member_function_pointer<void (Class::*)(...) const &&>(); - test_member_function_pointer<void (Class::*)(int,...) const &&>(); - test_member_function_pointer<void (Class::*)(int, char,...) const &&>(); - - test_member_function_pointer<void (Class::*)() volatile &&>(); - test_member_function_pointer<void (Class::*)(int) volatile &&>(); - test_member_function_pointer<void (Class::*)(int, char) volatile &&>(); - test_member_function_pointer<void (Class::*)(...) volatile &&>(); - test_member_function_pointer<void (Class::*)(int,...) volatile &&>(); - test_member_function_pointer<void (Class::*)(int, char,...) volatile &&>(); - - test_member_function_pointer<void (Class::*)() const volatile &&>(); - test_member_function_pointer<void (Class::*)(int) const volatile &&>(); - test_member_function_pointer<void (Class::*)(int, char) const volatile &&>(); - test_member_function_pointer<void (Class::*)(...) const volatile &&>(); - test_member_function_pointer<void (Class::*)(int,...) const volatile &&>(); - test_member_function_pointer<void (Class::*)(int, char,...) const volatile &&>(); + // Noexcept qualifiers + test_member_function_pointer<void (Class::*)() noexcept>(); + test_member_function_pointer<void (Class::*)(int) noexcept>(); + test_member_function_pointer<void (Class::*)(int, char) noexcept>(); + + test_member_function_pointer<void (Class::*)() const noexcept>(); + test_member_function_pointer<void (Class::*)(int) const noexcept>(); + test_member_function_pointer<void (Class::*)(int, char) const noexcept>(); + + test_member_function_pointer<void (Class::*)() volatile noexcept>(); + test_member_function_pointer<void (Class::*)(int) volatile noexcept>(); + test_member_function_pointer<void (Class::*)(int, char) volatile noexcept>(); + + test_member_function_pointer<void (Class::*)(...) noexcept>(); + test_member_function_pointer<void (Class::*)(int, ...) noexcept>(); + test_member_function_pointer<void (Class::*)(int, char, ...) noexcept>(); + + test_member_function_pointer<void (Class::*)(...) const noexcept>(); + test_member_function_pointer<void (Class::*)(int, ...) const noexcept>(); + test_member_function_pointer<void (Class::*)(int, char, ...) const noexcept>(); + + test_member_function_pointer<void (Class::*)(...) volatile noexcept>(); + test_member_function_pointer<void (Class::*)(int, ...) volatile noexcept>(); + test_member_function_pointer<void (Class::*)(int, char, ...) volatile noexcept>(); + + // lvalue qualifiers + test_member_function_pointer<void (Class::*)() &>(); + test_member_function_pointer<void (Class::*)(int) &>(); + test_member_function_pointer<void (Class::*)(int, char) &>(); + test_member_function_pointer<void (Class::*)(...) &>(); + test_member_function_pointer<void (Class::*)(int,...) &>(); + test_member_function_pointer<void (Class::*)(int, char,...) &>(); + + test_member_function_pointer<void (Class::*)() const &>(); + test_member_function_pointer<void (Class::*)(int) const &>(); + test_member_function_pointer<void (Class::*)(int, char) const &>(); + test_member_function_pointer<void (Class::*)(...) const &>(); + test_member_function_pointer<void (Class::*)(int,...) const &>(); + test_member_function_pointer<void (Class::*)(int, char,...) const &>(); + + test_member_function_pointer<void (Class::*)() volatile &>(); + test_member_function_pointer<void (Class::*)(int) volatile &>(); + test_member_function_pointer<void (Class::*)(int, char) volatile &>(); + test_member_function_pointer<void (Class::*)(...) volatile &>(); + test_member_function_pointer<void (Class::*)(int,...) volatile &>(); + test_member_function_pointer<void (Class::*)(int, char,...) volatile &>(); + + test_member_function_pointer<void (Class::*)() const volatile &>(); + test_member_function_pointer<void (Class::*)(int) const volatile &>(); + test_member_function_pointer<void (Class::*)(int, char) const volatile &>(); + test_member_function_pointer<void (Class::*)(...) const volatile &>(); + test_member_function_pointer<void (Class::*)(int,...) const volatile &>(); + test_member_function_pointer<void (Class::*)(int, char,...) const volatile &>(); + + // Lvalue qualifiers with noexcept + test_member_function_pointer<void (Class::*)() & noexcept>(); + test_member_function_pointer<void (Class::*)(int) & noexcept>(); + test_member_function_pointer<void (Class::*)(int, char) & noexcept>(); + test_member_function_pointer<void (Class::*)(...) & noexcept>(); + test_member_function_pointer<void (Class::*)(int,...) & noexcept>(); + test_member_function_pointer<void (Class::*)(int, char,...) & noexcept>(); + + test_member_function_pointer<void (Class::*)() const & noexcept>(); + test_member_function_pointer<void (Class::*)(int) const & noexcept>(); + test_member_function_pointer<void (Class::*)(int, char) const & noexcept>(); + test_member_function_pointer<void (Class::*)(...) const & noexcept>(); + test_member_function_pointer<void (Class::*)(int,...) const & noexcept>(); + test_member_function_pointer<void (Class::*)(int, char,...) const & noexcept>(); + + test_member_function_pointer<void (Class::*)() volatile & noexcept>(); + test_member_function_pointer<void (Class::*)(int) volatile & noexcept>(); + test_member_function_pointer<void (Class::*)(int, char) volatile & noexcept>(); + test_member_function_pointer<void (Class::*)(...) volatile & noexcept>(); + test_member_function_pointer<void (Class::*)(int,...) volatile & noexcept>(); + test_member_function_pointer<void (Class::*)(int, char,...) volatile & noexcept>(); + + test_member_function_pointer<void (Class::*)() const volatile & noexcept>(); + test_member_function_pointer<void (Class::*)(int) const volatile & noexcept>(); + test_member_function_pointer<void (Class::*)(int, char) const volatile & noexcept>(); + test_member_function_pointer<void (Class::*)(...) const volatile & noexcept>(); + test_member_function_pointer<void (Class::*)(int,...) const volatile & noexcept>(); + test_member_function_pointer<void (Class::*)(int, char,...) const volatile & noexcept>(); + + // RValue qualifiers + test_member_function_pointer<void (Class::*)() &&>(); + test_member_function_pointer<void (Class::*)(int) &&>(); + test_member_function_pointer<void (Class::*)(int, char) &&>(); + test_member_function_pointer<void (Class::*)(...) &&>(); + test_member_function_pointer<void (Class::*)(int,...) &&>(); + test_member_function_pointer<void (Class::*)(int, char,...) &&>(); + + test_member_function_pointer<void (Class::*)() const &&>(); + test_member_function_pointer<void (Class::*)(int) const &&>(); + test_member_function_pointer<void (Class::*)(int, char) const &&>(); + test_member_function_pointer<void (Class::*)(...) const &&>(); + test_member_function_pointer<void (Class::*)(int,...) const &&>(); + test_member_function_pointer<void (Class::*)(int, char,...) const &&>(); + + test_member_function_pointer<void (Class::*)() volatile &&>(); + test_member_function_pointer<void (Class::*)(int) volatile &&>(); + test_member_function_pointer<void (Class::*)(int, char) volatile &&>(); + test_member_function_pointer<void (Class::*)(...) volatile &&>(); + test_member_function_pointer<void (Class::*)(int,...) volatile &&>(); + test_member_function_pointer<void (Class::*)(int, char,...) volatile &&>(); + + test_member_function_pointer<void (Class::*)() const volatile &&>(); + test_member_function_pointer<void (Class::*)(int) const volatile &&>(); + test_member_function_pointer<void (Class::*)(int, char) const volatile &&>(); + test_member_function_pointer<void (Class::*)(...) const volatile &&>(); + test_member_function_pointer<void (Class::*)(int,...) const volatile &&>(); + test_member_function_pointer<void (Class::*)(int, char,...) const volatile &&>(); + + // RValue qualifiers with noexcept + test_member_function_pointer<void (Class::*)() && noexcept>(); + test_member_function_pointer<void (Class::*)(int) && noexcept>(); + test_member_function_pointer<void (Class::*)(int, char) && noexcept>(); + test_member_function_pointer<void (Class::*)(...) && noexcept>(); + test_member_function_pointer<void (Class::*)(int,...) && noexcept>(); + test_member_function_pointer<void (Class::*)(int, char,...) && noexcept>(); + + test_member_function_pointer<void (Class::*)() const && noexcept>(); + test_member_function_pointer<void (Class::*)(int) const && noexcept>(); + test_member_function_pointer<void (Class::*)(int, char) const && noexcept>(); + test_member_function_pointer<void (Class::*)(...) const && noexcept>(); + test_member_function_pointer<void (Class::*)(int,...) const && noexcept>(); + test_member_function_pointer<void (Class::*)(int, char,...) const && noexcept>(); + + test_member_function_pointer<void (Class::*)() volatile && noexcept>(); + test_member_function_pointer<void (Class::*)(int) volatile && noexcept>(); + test_member_function_pointer<void (Class::*)(int, char) volatile && noexcept>(); + test_member_function_pointer<void (Class::*)(...) volatile && noexcept>(); + test_member_function_pointer<void (Class::*)(int,...) volatile && noexcept>(); + test_member_function_pointer<void (Class::*)(int, char,...) volatile && noexcept>(); + + test_member_function_pointer<void (Class::*)() const volatile && noexcept>(); + test_member_function_pointer<void (Class::*)(int) const volatile && noexcept>(); + test_member_function_pointer<void (Class::*)(int, char) const volatile && noexcept>(); + test_member_function_pointer<void (Class::*)(...) const volatile && noexcept>(); + test_member_function_pointer<void (Class::*)(int,...) const volatile && noexcept>(); + test_member_function_pointer<void (Class::*)(int, char,...) const volatile && noexcept>(); #endif // LWG#2582 - static_assert(!std::is_member_function_pointer<incomplete_type>::value, ""); + static_assert(!std::is_member_function_pointer<incomplete_type>::value, ""); } diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp index a54adf10258f2..99ca74cc2fa91 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp @@ -65,6 +65,14 @@ class Abstract virtual ~Abstract() = 0; }; +template <class> +struct AbstractTemplate { + virtual void test() = 0; +}; + +template <> +struct AbstractTemplate<double> {}; + int main() { test_is_not_abstract<void>(); @@ -81,4 +89,6 @@ int main() test_is_not_abstract<NotEmpty>(); test_is_abstract<Abstract>(); + test_is_abstract<AbstractTemplate<int> >(); + test_is_not_abstract<AbstractTemplate<double> >(); } diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp new file mode 100644 index 0000000000000..9c72d4d44ce5d --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp @@ -0,0 +1,79 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// <type_traits> + +// template <class T> struct is_aggregate; +// template <class T> constexpr bool is_aggregate_v = is_aggregate<T>::value; + +#include <type_traits> +#include "test_macros.h" + +template <class T> +void test_true() +{ +#if !defined(_LIBCPP_HAS_NO_IS_AGGREGATE) + static_assert( std::is_aggregate<T>::value, ""); + static_assert( std::is_aggregate<const T>::value, ""); + static_assert( std::is_aggregate<volatile T>::value, ""); + static_assert( std::is_aggregate<const volatile T>::value, ""); + static_assert( std::is_aggregate_v<T>, ""); + static_assert( std::is_aggregate_v<const T>, ""); + static_assert( std::is_aggregate_v<volatile T>, ""); + static_assert( std::is_aggregate_v<const volatile T>, ""); +#endif +} + +template <class T> +void test_false() +{ +#if !defined(_LIBCPP_HAS_NO_IS_AGGREGATE) + static_assert(!std::is_aggregate<T>::value, ""); + static_assert(!std::is_aggregate<const T>::value, ""); + static_assert(!std::is_aggregate<volatile T>::value, ""); + static_assert(!std::is_aggregate<const volatile T>::value, ""); + static_assert(!std::is_aggregate_v<T>, ""); + static_assert(!std::is_aggregate_v<const T>, ""); + static_assert(!std::is_aggregate_v<volatile T>, ""); + static_assert(!std::is_aggregate_v<const volatile T>, ""); +#endif +} + +struct Aggregate {}; +struct HasCons { HasCons(int); }; +struct HasPriv { + void PreventUnusedPrivateMemberWarning(); +private: + int x; +}; +struct Union { int x; void* y; }; + + +int main () +{ + { + test_false<void>(); + test_false<int>(); + test_false<void*>(); + test_false<void()>(); + test_false<void() const>(); + test_false<void(Aggregate::*)(int) const>(); + test_false<Aggregate&>(); + test_false<HasCons>(); + test_false<HasPriv>(); + } + { + test_true<Aggregate>(); + test_true<Aggregate[]>(); + test_true<Aggregate[42][101]>(); + test_true<Union>(); + } +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp index f4736e7134226..3955d4bc3306b 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp @@ -82,5 +82,4 @@ int main() // pointer to incomplete template type test_is_assignable<X<D>*&, X<D>*> (); - test_is_not_assignable<Incomplete&, Incomplete const&>(); } diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp index f6ae401533a98..9d2ec5edea583 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp @@ -251,6 +251,7 @@ int main() LIBCPP_STATIC_ASSERT( clang_disallows_valid_static_cast_bug != std::__libcpp_is_constructible<int&&, ExplicitTo<int&&>>::value, ""); + ((void)clang_disallows_valid_static_cast_bug); // Prevent unused warning #else static_assert(clang_disallows_valid_static_cast_bug == false, ""); LIBCPP_STATIC_ASSERT(std::__libcpp_is_constructible<int&&, ExplicitTo<int&&>>::value, ""); diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp index 59aa5e26a2921..7ead5f5d5df95 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp @@ -77,7 +77,7 @@ int main() #endif // Before C++14, void was not a literal type -// In C++14, cv-void is is a literal type +// In C++14, cv-void is a literal type #if TEST_STD_VER < 14 test_is_not_literal_type<void>(); #else |