diff options
Diffstat (limited to 'test/libcxx/selftest/test_macros.pass.cpp')
-rw-r--r-- | test/libcxx/selftest/test_macros.pass.cpp | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/test/libcxx/selftest/test_macros.pass.cpp b/test/libcxx/selftest/test_macros.pass.cpp index 2c8ed4f454a7e..69e75b788711a 100644 --- a/test/libcxx/selftest/test_macros.pass.cpp +++ b/test/libcxx/selftest/test_macros.pass.cpp @@ -8,51 +8,59 @@ //===----------------------------------------------------------------------===// // // Test the "test_macros.h" header. +#include <__config> #include "test_macros.h" #ifndef TEST_STD_VER #error TEST_STD_VER must be defined #endif -#ifndef TEST_DECLTYPE -#error TEST_DECLTYPE must be defined -#endif - #ifndef TEST_NOEXCEPT #error TEST_NOEXCEPT must be defined #endif -#ifndef TEST_STATIC_ASSERT -#error TEST_STATIC_ASSERT must be defined +#ifndef LIBCPP_ASSERT +#error LIBCPP_ASSERT must be defined #endif -template <class T, class U> -struct is_same { enum { value = 0 }; }; - -template <class T> -struct is_same<T, T> { enum { value = 1 }; }; - -int foo() { return 0; } +#ifndef LIBCPP_STATIC_ASSERT +#error LIBCPP_STATIC_ASSERT must be defined +#endif void test_noexcept() TEST_NOEXCEPT { } -void test_decltype() +void test_libcxx_macros() { - typedef TEST_DECLTYPE(foo()) MyType; - TEST_STATIC_ASSERT((is_same<MyType, int>::value), "is same"); -} +// ===== C++14 features ===== +// defined(TEST_HAS_EXTENDED_CONSTEXPR) != defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) +#ifdef TEST_HAS_EXTENDED_CONSTEXPR +# ifdef _LIBCPP_HAS_NO_CXX14_CONSTEXPR +# error "TEST_EXTENDED_CONSTEXPR mismatch (1)" +# endif +#else +# ifndef _LIBCPP_HAS_NO_CXX14_CONSTEXPR +# error "TEST_EXTENDED_CONSTEXPR mismatch (2)" +# endif +#endif -void test_static_assert() -{ - TEST_STATIC_ASSERT((is_same<int, int>::value), "is same"); - TEST_STATIC_ASSERT((!is_same<int, long>::value), "not same"); +// defined(TEST_HAS_VARIABLE_TEMPLATES) != defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#ifdef TEST_HAS_VARIABLE_TEMPLATES +# ifdef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES +# error "TEST_VARIABLE_TEMPLATES mismatch (1)" +# endif +#else +# ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES +# error "TEST_VARIABLE_TEMPLATES mismatch (2)" +# endif +#endif + +// ===== C++1z features ===== } int main() { test_noexcept(); - test_decltype(); - test_static_assert(); + test_libcxx_macros(); } |