Revert "Revert "Update aosp/master libcxx rebase to r263688""
This reverts commit 1d4a1edbc7.
Change-Id: I2909937fe582f2c5552bc86e7f4d2d5cff0de0aa
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user