// Copyright 2016 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include struct s {}; union u {}; using fp = void(); // is_void tests: static_assert(fbl::is_void::value, ""); static_assert(fbl::is_void::value, ""); static_assert(fbl::is_void::value, ""); static_assert(fbl::is_void::value, ""); static_assert(!fbl::is_void::value, ""); static_assert(!fbl::is_void::value, ""); // is_null_pointer tests: static_assert(fbl::is_null_pointer::value, ""); static_assert(fbl::is_null_pointer::value, ""); static_assert(fbl::is_null_pointer::value, ""); static_assert(fbl::is_null_pointer::value, ""); static_assert(!fbl::is_null_pointer::value, ""); static_assert(!fbl::is_null_pointer::value, ""); static_assert(!fbl::is_null_pointer::value, ""); static_assert(!fbl::is_null_pointer::value, ""); // is_pointer tests: static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); static_assert(!fbl::is_pointer::value, ""); // is_reference tests: static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); static_assert(!fbl::is_reference::value, ""); // is_union tests: static_assert(fbl::is_union::value, ""); static_assert(!fbl::is_union::value, ""); static_assert(!fbl::is_union::value, ""); static_assert(!fbl::is_union::value, ""); static_assert(!fbl::is_union::value, ""); static_assert(!fbl::is_union::value, ""); static_assert(!fbl::is_union::value, ""); static_assert(!fbl::is_union::value, ""); static_assert(!fbl::is_union::value, ""); // is_const tests: static_assert(!fbl::is_const::value, ""); static_assert(fbl::is_const::value, ""); static_assert(!fbl::is_const::value, ""); static_assert(fbl::is_const::value, ""); static_assert(!fbl::is_const::value, ""); static_assert(fbl::is_const::value, ""); static_assert(!fbl::is_const::value, ""); static_assert(fbl::is_const::value, ""); static_assert(!fbl::is_const::value, ""); static_assert(fbl::is_const::value, ""); // underlying_type: enum int_enum : int {}; enum char_enum : char {}; static_assert(fbl::is_same::type, int>::value, "expected int"); static_assert(fbl::is_same::type, char>::value, "expected char"); // match_cv tests: static_assert(fbl::is_same::type, void>::value, "wrong type"); static_assert(fbl::is_same::type, const void>::value, "wrong type"); static_assert(fbl::is_same::type, volatile char>::value, "wrong type"); static_assert(fbl::is_same::type, const char>::value, "wrong type"); static_assert(fbl::is_same::type, const char>::value, "wrong type"); static_assert(fbl::is_same::type, void>::value, "wrong type"); // is_class tests namespace is_class_tests { static_assert(!fbl::is_class::value, "'int' should not pass the is_class<> test!"); class A { }; static_assert(fbl::is_class::value, "'class' should pass the is_class<> test!"); struct B { }; static_assert(fbl::is_class::value, "'struct' should pass the is_class<> test!"); union C { int a; float b; }; static_assert(!fbl::is_class::value, "'union' should not pass the is_class<> test!"); enum D { D_ENUM_VALUE }; static_assert(!fbl::is_class::value, "'enum' should not pass the is_class<> test!"); enum class E { VALUE }; static_assert(!fbl::is_class::value, "'enum class' should not pass the is_class<> test!"); } // namespace is_class_tests // is_base_of tests namespace is_base_of_tests { static_assert(!fbl::is_base_of::value, "scalar types should not be bases of scalar types"); class A { }; static_assert(fbl::is_base_of::value, "A should be a base of A!"); class B : public A { }; static_assert( fbl::is_base_of::value, "B should be a base of B!"); static_assert( fbl::is_base_of::value, "A should be a base of B!"); static_assert(!fbl::is_base_of::value, "B should not be a base of A!"); class C : public B { }; static_assert( fbl::is_base_of::value, "C should be a base of C!"); static_assert( fbl::is_base_of::value, "B should be a base of C!"); static_assert( fbl::is_base_of::value, "A should be a base of C!"); static_assert(!fbl::is_base_of::value, "C should not be a base of B!"); static_assert(!fbl::is_base_of::value, "C should not be a base of A!"); class D { }; class E : public B, public D { }; static_assert( fbl::is_base_of::value, "D should be a base of D!"); static_assert( fbl::is_base_of::value, "E should be a base of E!"); static_assert( fbl::is_base_of::value, "A should be a base of E!"); static_assert( fbl::is_base_of::value, "B should be a base of E!"); static_assert(!fbl::is_base_of::value, "C should not be a base of E!"); static_assert( fbl::is_base_of::value, "D should be a base of E!"); static_assert(!fbl::is_base_of::value, "E should not be a base of A!"); static_assert(!fbl::is_base_of::value, "E should not be a base of B!"); static_assert(!fbl::is_base_of::value, "E should not be a base of C!"); static_assert(!fbl::is_base_of::value, "E should not be a base of D!"); struct sA { }; static_assert(fbl::is_base_of::value, "sA should be a base of sA!"); struct sB : public sA { }; static_assert( fbl::is_base_of::value, "sB should be a base of sB!"); static_assert( fbl::is_base_of::value, "sA should be a base of sB!"); static_assert(!fbl::is_base_of::value, "sB should not be a base of sA!"); struct sC : public sB { }; static_assert( fbl::is_base_of::value, "sC should be a base of sC!"); static_assert( fbl::is_base_of::value, "sB should be a base of sC!"); static_assert( fbl::is_base_of::value, "sA should be a base of sC!"); static_assert(!fbl::is_base_of::value, "sC should not be a base of sB!"); static_assert(!fbl::is_base_of::value, "sC should not be a base of sA!"); struct sD { }; struct sE : public sB, public sD { }; static_assert( fbl::is_base_of::value, "sD should be a base of sD!"); static_assert( fbl::is_base_of::value, "sE should be a base of sE!"); static_assert( fbl::is_base_of::value, "sA should be a base of sE!"); static_assert( fbl::is_base_of::value, "sB should be a base of sE!"); static_assert(!fbl::is_base_of::value, "sC should not be a base of sE!"); static_assert( fbl::is_base_of::value, "sD should be a base of sE!"); static_assert(!fbl::is_base_of::value, "sE should not be a base of sA!"); static_assert(!fbl::is_base_of::value, "sE should not be a base of sB!"); static_assert(!fbl::is_base_of::value, "sE should not be a base of sC!"); static_assert(!fbl::is_base_of::value, "sE should not be a base of sD!"); } // namespace is_base_of_tests namespace has_virtual_destructor_tests { struct A { ~A() { } }; struct B { virtual ~B() { } }; struct C : public A { ~C() { } }; struct D : public B { ~D() { } }; struct E : public A { virtual ~E() { } }; static_assert(!fbl::has_virtual_destructor::value, "A should have no virtual destructor"); static_assert( fbl::has_virtual_destructor::value, "B should have a virtual destructor"); static_assert(!fbl::has_virtual_destructor::value, "C should have no virtual destructor"); static_assert( fbl::has_virtual_destructor::value, "D should have a virtual destructor"); static_assert( fbl::has_virtual_destructor::value, "E should have a virtual destructor"); } // namespace has_virtual_destructor_tests namespace is_floating_point { static_assert(fbl::is_floating_point::value, "float is floating point"); static_assert(fbl::is_floating_point::value, "double is floating point"); static_assert(fbl::is_floating_point::value, "long double is floating point"); static_assert(!fbl::is_floating_point::value, "int is not floating point"); static_assert(!fbl::is_floating_point::value, "nullptr is not floating point"); struct A {}; static_assert(!fbl::is_floating_point::value, "A is not floating point"); static_assert(!fbl::is_floating_point::value, "A pointer is not floating point"); } // namespace is_floating_point namespace is_integral_tests { static_assert(fbl::is_integral::value, "bool is integral"); static_assert(fbl::is_integral::value, "char is integral"); static_assert(fbl::is_integral::value, "char16_t is integral"); static_assert(fbl::is_integral::value, "char32_t is integral"); static_assert(fbl::is_integral::value, "wchar_t is integral"); static_assert(fbl::is_integral::value, "signed char is integral"); static_assert(fbl::is_integral::value, "unsigned char is integral"); static_assert(fbl::is_integral::value, "short int is integral"); static_assert(fbl::is_integral::value, "unsigned short int is integral"); static_assert(fbl::is_integral::value, "int is integral"); static_assert(fbl::is_integral::value, "unsigned int is integral"); static_assert(fbl::is_integral::value, "long int is integral"); static_assert(fbl::is_integral::value, "unsigned long int is integral"); static_assert(fbl::is_integral::value, "long long int is integral"); static_assert(fbl::is_integral::value, "unsigned long long int is integral"); static_assert(!fbl::is_integral::value, "float is not integral"); static_assert(!fbl::is_integral::value, "nullptr is not integral"); struct A {}; static_assert(!fbl::is_integral::value, "A is not floating point"); static_assert(!fbl::is_integral::value, "A pointer is not integral"); } // namespace is_integral_tests namespace is_arithmetic_tests { static_assert(fbl::is_arithmetic::value, "bool is arithmetic"); static_assert(fbl::is_arithmetic::value, "char is arithmetic"); static_assert(fbl::is_arithmetic::value, "char16_t is arithmetic"); static_assert(fbl::is_arithmetic::value, "char32_t is arithmetic"); static_assert(fbl::is_arithmetic::value, "wchar_t is arithmetic"); static_assert(fbl::is_arithmetic::value, "signed char is arithmetic"); static_assert(fbl::is_arithmetic::value, "unsigned char is arithmetic"); static_assert(fbl::is_arithmetic::value, "short int is arithmetic"); static_assert(fbl::is_arithmetic::value, "unsigned short int is arithmetic"); static_assert(fbl::is_arithmetic::value, "int is arithmetic"); static_assert(fbl::is_arithmetic::value, "unsigned int is arithmetic"); static_assert(fbl::is_arithmetic::value, "long int is arithmetic"); static_assert(fbl::is_arithmetic::value, "unsigned long int is arithmetic"); static_assert(fbl::is_arithmetic::value, "long long int is arithmetic"); static_assert(fbl::is_arithmetic::value, "unsigned long long int is arithmetic"); static_assert(fbl::is_arithmetic::value, "float is arithmetic"); static_assert(fbl::is_arithmetic::value, "double is arithmetic"); static_assert(fbl::is_arithmetic::value, "long double is arithmetic"); static_assert(!fbl::is_arithmetic::value, "nullptr is not arithmetic"); struct A {}; static_assert(!fbl::is_arithmetic::value, "A is not arithmetic"); static_assert(!fbl::is_arithmetic::value, "A pointer is not arithmetic"); } // namespace is_arithmetic_tests namespace is_signed_tests { static_assert(fbl::is_signed::value, "int is signed"); static_assert(!fbl::is_signed::value, "unsigned int is not signed"); static_assert(fbl::is_signed::value, "float is signed"); static_assert(!fbl::is_signed::value, "nullptr is not signed"); struct A {}; static_assert(!fbl::is_signed::value, "A is not signed"); static_assert(!fbl::is_signed::value, "A pointer is not signed"); } // namespace is_signed_tests namespace is_unsigned_tests { static_assert(!fbl::is_unsigned::value, "int is not unsigned"); static_assert(fbl::is_unsigned::value, "unsigned int is unsigned"); static_assert(!fbl::is_unsigned::value, "float is not unsigned"); static_assert(!fbl::is_unsigned::value, "nullptr is not unsigned"); struct A {}; static_assert(!fbl::is_unsigned::value, "A is not unsigned"); static_assert(!fbl::is_unsigned::value, "A pointer is not unsigned"); } // namespace is_unsigned_tests namespace is_signed_integer_tests { static_assert(fbl::is_signed_integer::value, "int is signed integer"); static_assert(!fbl::is_signed_integer::value, "unsigned int is not signed integer"); static_assert(!fbl::is_signed_integer::value, "float is not signed integer"); static_assert(!fbl::is_signed_integer::value, "nullptr is not signed integer"); struct A {}; static_assert(!fbl::is_signed_integer::value, "A is not signed integer"); static_assert(!fbl::is_signed_integer::value, "A pointer is not signed integer"); } // namespace is_signed_integer_tests namespace is_unsigned_integer_tests { static_assert(!fbl::is_unsigned_integer::value, "int is not unsigned integer"); static_assert(fbl::is_unsigned_integer::value, "unsigned int is unsigned integer"); static_assert(!fbl::is_unsigned_integer::value, "float is not unsigned integer"); static_assert(!fbl::is_unsigned_integer::value, "nullptr is not unsigned integer"); struct A {}; static_assert(!fbl::is_unsigned_integer::value, "A is not unsigned integer"); static_assert(!fbl::is_unsigned_integer::value, "A pointer is not unsigned integer"); } // namespace is_unsigned_integer_tests namespace is_enum_tests { enum E {}; struct S {}; static_assert(fbl::is_enum::value, "enum is an enum"); static_assert(!fbl::is_enum::value, "struct is not an enum"); static_assert(!fbl::is_enum::value, "int is not an enum"); static_assert(!fbl::is_enum::value, "void is not an enum"); } // namespace is_enum_tests namespace is_pointer_tests { struct StructType { void MemberFunction(); int member_variable; static void StaticMemberFunction(); static int static_member_variable; }; static void SomeStaticFunc() { } void SomeGlobalFunc() { // Force an artifical use of SomeStaticFunc to avoid warnings. SomeStaticFunc(); } class ClassType { }; enum EnumType { One, Two }; union UnionType { int a; double b; }; static_assert(!fbl::is_pointer::value, "StructType is not a pointer!"); static_assert( fbl::is_pointer::value, "StructType* is a pointer!"); static_assert( fbl::is_pointer::value, "StructType** is a pointer!"); static_assert(!fbl::is_pointer::value, "ClassType is not a pointer!"); static_assert( fbl::is_pointer::value, "ClassType* is a pointer!"); static_assert( fbl::is_pointer::value, "ClassType** is a pointer!"); static_assert(!fbl::is_pointer::value, "EnumType is not a pointer!"); static_assert( fbl::is_pointer::value, "EnumType* is a pointer!"); static_assert( fbl::is_pointer::value, "EnumType** is a pointer!"); static_assert(!fbl::is_pointer::value, "UnionType is not a pointer!"); static_assert( fbl::is_pointer::value, "UnionType* is a pointer!"); static_assert( fbl::is_pointer::value, "UnionType** is a pointer!"); static_assert(!fbl::is_pointer::value, "int is not a pointer!"); static_assert(!fbl::is_pointer::value, "int[] is not a pointer!"); static_assert( fbl::is_pointer::value, "int* is a pointer!"); static_assert( fbl::is_pointer::value, "int** is a pointer!"); static_assert(!fbl::is_pointer::value, "const int is not a pointer!"); static_assert(!fbl::is_pointer::value, "volatile int is not a pointer!"); static_assert(!fbl::is_pointer::value, "const volatile int is not a pointer!"); static_assert( fbl::is_pointer::value, "const int* is a pointer!"); static_assert( fbl::is_pointer::value, "volatile int* is a pointer!"); static_assert( fbl::is_pointer::value, "const volatile int* is a pointer!"); static_assert( fbl::is_pointer::value, "int* const is a pointer!"); static_assert( fbl::is_pointer::value, "int* volatile is a pointer!"); static_assert( fbl::is_pointer::value, "int* const volatile is a pointer!"); static_assert( fbl::is_pointer::value, "const int* const is a pointer!"); static_assert( fbl::is_pointer::value, "const int* volatile is a pointer!"); static_assert( fbl::is_pointer::value, "const int* const volatile is a pointer!"); static_assert( fbl::is_pointer::value, "volatile int* const is a pointer!"); static_assert( fbl::is_pointer::value, "volatile int* volatile is a pointer!"); static_assert( fbl::is_pointer::value, "volatile int* const volatile is a pointer!"); static_assert( fbl::is_pointer::value, "const volatile int* const is a pointer!"); static_assert( fbl::is_pointer::value, "const volatile int* volatile is a pointer!"); static_assert( fbl::is_pointer::value, "const volatile int* const volatile is a pointer!"); static_assert(!fbl::is_pointer::value, "pointer to StructType::MemberFunction is not a pointer!"); static_assert(!fbl::is_pointer::value, "pointer to StructType::member_variable is not a pointer!"); static_assert( fbl::is_pointer::value, "pointer to StructType::MemberFunction is a pointer!"); static_assert( fbl::is_pointer::value, "pointer to StructType::static_member_variable is a pointer!"); static_assert( fbl::is_pointer::value, "pointer to SomeGlobalFunc is a pointer!"); static_assert( fbl::is_pointer::value, "pointer to SomeStaticFunc is a pointer!"); static_assert(!fbl::is_pointer::value, "decltype(nullptr) (aka nullptr_t) is not a pointer (because C++)"); } // namespace is_pointer_tests; namespace is_convertible_tests { class A { }; class B : public A { }; class C { }; template using icp = fbl::is_convertible_pointer; static_assert( icp::value, "Should convert B* --> A*"); static_assert(!icp::value, "Should not convert A* --> B*"); static_assert(!icp::value, "Should not convert A --> B*"); static_assert(!icp::value, "Should not convert A* --> B"); static_assert(!icp::value, "Should not convert A --> B"); static_assert(!icp::value, "Should not convert A* --> C*"); static_assert( icp::value, "Should convert int* --> void*"); static_assert( icp::value, "Should convert int* --> const int*"); static_assert( icp::value, "Should convert int* --> volatile int*"); static_assert(!icp::value, "Should not convert const int* --> int*"); static_assert(!icp::value, "Should not convert volatile int* --> int*"); static_assert(!icp::value, "Should not convert unsigned int* --> int*"); static_assert(!icp::value, "Should not convert int* --> unsigned int*"); static_assert(!icp::value, "Should not convert float* --> double*"); } // namespace is_convertible_tests namespace conditional_tests { static_assert(fbl::is_same::type, int>::value, "wrong type"); static_assert(fbl::is_same::type, bool>::value, "wrong type"); } // namespace conditional_tests namespace has_member_fn_tests { struct A { void simple(); void overloaded(); int overloaded(int); int overloaded(int) const; }; struct B { int simple(); int overloaded(int) const; }; struct C {}; DECLARE_HAS_MEMBER_FN(has_simple, simple); DECLARE_HAS_MEMBER_FN(has_overloaded, overloaded); DECLARE_HAS_MEMBER_FN_WITH_SIGNATURE(has_simple_void, simple, void (C::*)()); DECLARE_HAS_MEMBER_FN_WITH_SIGNATURE(has_simple_int, simple, int (C::*)()); DECLARE_HAS_MEMBER_FN_WITH_SIGNATURE(has_overloaded_void, overloaded, void (C::*)()); DECLARE_HAS_MEMBER_FN_WITH_SIGNATURE(has_overloaded_int, overloaded, int (C::*)(int)); DECLARE_HAS_MEMBER_FN_WITH_SIGNATURE(has_overloaded_int_const, overloaded, int (C::*)(int) const); static_assert(has_simple::value, ""); static_assert(has_simple::value, ""); static_assert(!has_simple::value, ""); static_assert(!has_simple::value, ""); static_assert(!has_simple::value, ""); static_assert(!has_overloaded::value, "fails due to ambiguity"); static_assert(has_overloaded::value, "unambiguous"); static_assert(!has_overloaded::value, ""); static_assert(!has_overloaded::value, ""); static_assert(!has_overloaded::value, ""); static_assert(has_simple_void::value, ""); static_assert(!has_simple_void::value, ""); static_assert(!has_simple_void::value, ""); static_assert(!has_simple_void::value, ""); static_assert(!has_simple_void::value, ""); static_assert(!has_simple_int::value, ""); static_assert(has_simple_int::value, ""); static_assert(!has_simple_int::value, ""); static_assert(!has_simple_int::value, ""); static_assert(!has_simple_int::value, ""); static_assert(has_overloaded_void::value, ""); static_assert(!has_overloaded_void::value, ""); static_assert(!has_overloaded_void::value, ""); static_assert(!has_overloaded_void::value, ""); static_assert(!has_overloaded_void::value, ""); static_assert(has_overloaded_int::value, ""); static_assert(!has_overloaded_int::value, ""); static_assert(!has_overloaded_int::value, ""); static_assert(!has_overloaded_int::value, ""); static_assert(!has_overloaded_int::value, ""); static_assert(has_overloaded_int_const::value, ""); static_assert(has_overloaded_int_const::value, ""); static_assert(!has_overloaded_int_const::value, ""); static_assert(!has_overloaded_int_const::value, ""); static_assert(!has_overloaded_int_const::value, ""); } // namespace has_member_fn_tests // is_function tests: namespace is_function_tests { struct s {}; union u {}; struct forward_s; // Lots of things are not functions. static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); // There are pointers to void, but no references to void or arrays of // void. static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); using member_function_pointer = void(s::*)(); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); // Functions are functions, but pointers or references to them are // not. using void_to_void = void(); static_assert(fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); using void_to_int = int(); static_assert(fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); using int_to_void = void(int); static_assert(fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); using int_to_int = int(int); static_assert(fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); using s_to_void = void(s); static_assert(fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); using u_to_void = void(u); static_assert(fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); using va_to_void = void(...); static_assert(fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); using int_va_to_void = void(int, ...); static_assert(fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); static_assert(!fbl::is_function::value, ""); auto lambda = [](){}; auto function_pointer_inside_lambda = static_cast(lambda); static_assert(fbl::is_pointer::value, ""); using function_type = fbl::remove_pointer::type; static_assert(fbl::is_function::value, ""); }; // namespace is_function_tests