Guard libc++ specific c.__invariants() tests in LIBCPP_ASSERT macros

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267947 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2016-04-28 22:28:23 +00:00
parent bda804ea25
commit 375e2f669c
101 changed files with 390 additions and 342 deletions

View File

@@ -14,45 +14,23 @@
#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()
{
typedef TEST_DECLTYPE(foo()) MyType;
TEST_STATIC_ASSERT((is_same<MyType, int>::value), "is same");
}
void test_static_assert()
{
TEST_STATIC_ASSERT((is_same<int, int>::value), "is same");
TEST_STATIC_ASSERT((!is_same<int, long>::value), "not same");
}
int main()
{
test_noexcept();
test_decltype();
test_static_assert();
}