From 61b9a7258a7693d7f3674a5a1daf7b036ff1d382 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 6 Sep 2015 18:46:46 +0000 Subject: Import libc++ 3.7.0 release (r246257). --- test/libcxx/selftest/test_macros.pass.cpp | 58 +++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 test/libcxx/selftest/test_macros.pass.cpp (limited to 'test/libcxx/selftest/test_macros.pass.cpp') diff --git a/test/libcxx/selftest/test_macros.pass.cpp b/test/libcxx/selftest/test_macros.pass.cpp new file mode 100644 index 0000000000000..2c8ed4f454a7e --- /dev/null +++ b/test/libcxx/selftest/test_macros.pass.cpp @@ -0,0 +1,58 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// +// Test the "test_macros.h" header. +#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 +#endif + +template +struct is_same { enum { value = 0 }; }; + +template +struct is_same { enum { value = 1 }; }; + +int foo() { return 0; } + +void test_noexcept() TEST_NOEXCEPT +{ +} + +void test_decltype() +{ + typedef TEST_DECLTYPE(foo()) MyType; + TEST_STATIC_ASSERT((is_same::value), "is same"); +} + +void test_static_assert() +{ + TEST_STATIC_ASSERT((is_same::value), "is same"); + TEST_STATIC_ASSERT((!is_same::value), "not same"); +} + +int main() +{ + test_noexcept(); + test_decltype(); + test_static_assert(); +} -- cgit v1.2.3