[libcxx-commits] [libcxx] 9dfb142 - [libc++] Use ASSERT_SAME_TYPE instead of <type_traits> in depr tests
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 2 09:37:45 PST 2023
Author: Louis Dionne
Date: 2023-03-02T12:37:03-05:00
New Revision: 9dfb142ce0bfa11ea7cd9176c27b6c0fca7243e0
URL: https://github.com/llvm/llvm-project/commit/9dfb142ce0bfa11ea7cd9176c27b6c0fca7243e0
DIFF: https://github.com/llvm/llvm-project/commit/9dfb142ce0bfa11ea7cd9176c27b6c0fca7243e0.diff
LOG: [libc++] Use ASSERT_SAME_TYPE instead of <type_traits> in depr tests
Whenever, possible, use ASSERT_SAME_TYPE instead of static_assert along
with std::is_same in the depr header tests. This prevents dragging in
multiple headers unrelated to the header being tested, which can (and
has) hidden issues.
Also, add a couple of tests to ensure that basic declarations in
<stddef.h> and <stdint.h> are available when including just those
headers, since the rest of the tests for those types require pulling
in additional dependencies.
Differential Revision: https://reviews.llvm.org/D145116
Added:
libcxx/test/std/depr/depr.c.headers/inttypes_h.compile.pass.cpp
libcxx/test/std/depr/depr.c.headers/stddef_h.compile.pass.cpp
libcxx/test/std/depr/depr.c.headers/stddef_h.nullptr.pass.cpp
libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp
Modified:
libcxx/test/std/depr/depr.c.headers/ctype_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp
libcxx/test/std/depr/depr.c.headers/locale_h.compile.pass.cpp
libcxx/test/std/depr/depr.c.headers/math_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp
libcxx/test/std/depr/depr.c.headers/signal_h.compile.pass.cpp
libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/string_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/time_h.compile.pass.cpp
libcxx/test/std/depr/depr.c.headers/wctype_h.compile.pass.cpp
Removed:
libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp
################################################################################
diff --git a/libcxx/test/std/depr/depr.c.headers/ctype_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/ctype_h.pass.cpp
index 94bff2e1d8ef0..29ea1f83bb0b0 100644
--- a/libcxx/test/std/depr/depr.c.headers/ctype_h.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/ctype_h.pass.cpp
@@ -9,8 +9,8 @@
// <ctype.h>
#include <ctype.h>
-#include <type_traits>
-#include <cassert>
+
+#include "test_macros.h"
#ifdef isalnum
#error isalnum defined
@@ -68,22 +68,24 @@
#error toupper defined
#endif
-int main(int, char**) {
- static_assert(std::is_same<decltype(isalnum(0)), int>::value, "");
- static_assert(std::is_same<decltype(isalpha(0)), int>::value, "");
- static_assert(std::is_same<decltype(isblank(0)), int>::value, "");
- static_assert(std::is_same<decltype(iscntrl(0)), int>::value, "");
- static_assert(std::is_same<decltype(isdigit(0)), int>::value, "");
- static_assert(std::is_same<decltype(isgraph(0)), int>::value, "");
- static_assert(std::is_same<decltype(islower(0)), int>::value, "");
- static_assert(std::is_same<decltype(isprint(0)), int>::value, "");
- static_assert(std::is_same<decltype(ispunct(0)), int>::value, "");
- static_assert(std::is_same<decltype(isspace(0)), int>::value, "");
- static_assert(std::is_same<decltype(isupper(0)), int>::value, "");
- static_assert(std::is_same<decltype(isxdigit(0)), int>::value, "");
- static_assert(std::is_same<decltype(tolower(0)), int>::value, "");
- static_assert(std::is_same<decltype(toupper(0)), int>::value, "");
+ASSERT_SAME_TYPE(int, decltype(isalnum(0)));
+ASSERT_SAME_TYPE(int, decltype(isalpha(0)));
+ASSERT_SAME_TYPE(int, decltype(isblank(0)));
+ASSERT_SAME_TYPE(int, decltype(iscntrl(0)));
+ASSERT_SAME_TYPE(int, decltype(isdigit(0)));
+ASSERT_SAME_TYPE(int, decltype(isgraph(0)));
+ASSERT_SAME_TYPE(int, decltype(islower(0)));
+ASSERT_SAME_TYPE(int, decltype(isprint(0)));
+ASSERT_SAME_TYPE(int, decltype(ispunct(0)));
+ASSERT_SAME_TYPE(int, decltype(isspace(0)));
+ASSERT_SAME_TYPE(int, decltype(isupper(0)));
+ASSERT_SAME_TYPE(int, decltype(isxdigit(0)));
+ASSERT_SAME_TYPE(int, decltype(tolower(0)));
+ASSERT_SAME_TYPE(int, decltype(toupper(0)));
+#include <cassert>
+
+int main(int, char**) {
assert(isalnum('a'));
assert(isalpha('a'));
assert(isblank(' '));
diff --git a/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp
index da030e1283500..d1f56b800aa3c 100644
--- a/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp
@@ -9,7 +9,8 @@
// <fenv.h>
#include <fenv.h>
-#include <type_traits>
+
+#include "test_macros.h"
#ifndef FE_DIVBYZERO
#error FE_DIVBYZERO not defined
@@ -57,14 +58,14 @@
fenv_t fenv = {};
fexcept_t fex = 0;
-static_assert(std::is_same<decltype(::feclearexcept(0)), int>::value, "");
-static_assert(std::is_same<decltype(::fegetexceptflag(&fex, 0)), int>::value, "");
-static_assert(std::is_same<decltype(::feraiseexcept(0)), int>::value, "");
-static_assert(std::is_same<decltype(::fesetexceptflag(&fex, 0)), int>::value, "");
-static_assert(std::is_same<decltype(::fetestexcept(0)), int>::value, "");
-static_assert(std::is_same<decltype(::fegetround()), int>::value, "");
-static_assert(std::is_same<decltype(::fesetround(0)), int>::value, "");
-static_assert(std::is_same<decltype(::fegetenv(&fenv)), int>::value, "");
-static_assert(std::is_same<decltype(::feholdexcept(&fenv)), int>::value, "");
-static_assert(std::is_same<decltype(::fesetenv(&fenv)), int>::value, "");
-static_assert(std::is_same<decltype(::feupdateenv(&fenv)), int>::value, "");
+ASSERT_SAME_TYPE(int, decltype(::feclearexcept(0)));
+ASSERT_SAME_TYPE(int, decltype(::fegetexceptflag(&fex, 0)));
+ASSERT_SAME_TYPE(int, decltype(::feraiseexcept(0)));
+ASSERT_SAME_TYPE(int, decltype(::fesetexceptflag(&fex, 0)));
+ASSERT_SAME_TYPE(int, decltype(::fetestexcept(0)));
+ASSERT_SAME_TYPE(int, decltype(::fegetround()));
+ASSERT_SAME_TYPE(int, decltype(::fesetround(0)));
+ASSERT_SAME_TYPE(int, decltype(::fegetenv(&fenv)));
+ASSERT_SAME_TYPE(int, decltype(::feholdexcept(&fenv)));
+ASSERT_SAME_TYPE(int, decltype(::fesetenv(&fenv)));
+ASSERT_SAME_TYPE(int, decltype(::feupdateenv(&fenv)));
diff --git a/libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/inttypes_h.compile.pass.cpp
similarity index 88%
rename from libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
rename to libcxx/test/std/depr/depr.c.headers/inttypes_h.compile.pass.cpp
index dc47114b620da..eaae3aa3417e4 100644
--- a/libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/inttypes_h.compile.pass.cpp
@@ -9,7 +9,6 @@
// test <inttypes.h>
#include <inttypes.h>
-#include <type_traits>
#include "test_macros.h"
@@ -873,63 +872,51 @@
#error SCNxPTR not defined
#endif
-template <class T>
-void test() {
- T t = 0;
- ((void)t); // Prevent unused warning
-}
-
-int main(int, char**) {
- test<int8_t >();
- test<int16_t>();
- test<int32_t>();
- test<int64_t>();
-
- test<uint8_t >();
- test<uint16_t>();
- test<uint32_t>();
- test<uint64_t>();
-
- test<int_least8_t >();
- test<int_least16_t>();
- test<int_least32_t>();
- test<int_least64_t>();
-
- test<uint_least8_t >();
- test<uint_least16_t>();
- test<uint_least32_t>();
- test<uint_least64_t>();
-
- test<int_fast8_t >();
- test<int_fast16_t>();
- test<int_fast32_t>();
- test<int_fast64_t>();
-
- test<uint_fast8_t >();
- test<uint_fast16_t>();
- test<uint_fast32_t>();
- test<uint_fast64_t>();
-
- test<intptr_t >();
- test<uintptr_t>();
- test<intmax_t >();
- test<uintmax_t>();
-
- {
- imaxdiv_t i1 = {};
- ((void)i1); // Prevent unused warning
- }
-
- intmax_t i = 0;
- ((void)i); // Prevent unused warning
- static_assert((std::is_same<decltype(imaxabs(i)), intmax_t>::value), "");
- static_assert((std::is_same<decltype(imaxdiv(i, i)), imaxdiv_t>::value), "");
- static_assert((std::is_same<decltype(strtoimax("", (char**)0, 0)), intmax_t>::value), "");
- static_assert((std::is_same<decltype(strtoumax("", (char**)0, 0)), uintmax_t>::value), "");
+void f() {
+ { int8_t x = 0; (void)x; }
+ { int16_t x = 0; (void)x; }
+ { int32_t x = 0; (void)x; }
+ { int64_t x = 0; (void)x; }
+
+ { uint8_t x = 0; (void)x; }
+ { uint16_t x = 0; (void)x; }
+ { uint32_t x = 0; (void)x; }
+ { uint64_t x = 0; (void)x; }
+
+ { int_least8_t x = 0; (void)x; }
+ { int_least16_t x = 0; (void)x; }
+ { int_least32_t x = 0; (void)x; }
+ { int_least64_t x = 0; (void)x; }
+
+ { uint_least8_t x = 0; (void)x; }
+ { uint_least16_t x = 0; (void)x; }
+ { uint_least32_t x = 0; (void)x; }
+ { uint_least64_t x = 0; (void)x; }
+
+ { int_fast8_t x = 0; (void)x; }
+ { int_fast16_t x = 0; (void)x; }
+ { int_fast32_t x = 0; (void)x; }
+ { int_fast64_t x = 0; (void)x; }
+
+ { uint_fast8_t x = 0; (void)x; }
+ { uint_fast16_t x = 0; (void)x; }
+ { uint_fast32_t x = 0; (void)x; }
+ { uint_fast64_t x = 0; (void)x; }
+
+ { intptr_t x = 0; (void)x; }
+ { uintptr_t x = 0; (void)x; }
+ { intmax_t x = 0; (void)x; }
+ { uintmax_t x = 0; (void)x; }
+
+ { imaxdiv_t x = {}; (void)x; }
+
+ intmax_t i = 0; (void)i;
+ ASSERT_SAME_TYPE(intmax_t, decltype(imaxabs(i)));
+ ASSERT_SAME_TYPE(imaxdiv_t, decltype(imaxdiv(i, i)));
+ ASSERT_SAME_TYPE(intmax_t, decltype(strtoimax("", (char**)0, 0)));
+ ASSERT_SAME_TYPE(uintmax_t, decltype(strtoumax("", (char**)0, 0)));
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
- static_assert((std::is_same<decltype(wcstoimax(L"", (wchar_t**)0, 0)), intmax_t>::value), "");
- static_assert((std::is_same<decltype(wcstoumax(L"", (wchar_t**)0, 0)), uintmax_t>::value), "");
+ ASSERT_SAME_TYPE(intmax_t, decltype(wcstoimax(L"", (wchar_t**)0, 0)));
+ ASSERT_SAME_TYPE(uintmax_t, decltype(wcstoumax(L"", (wchar_t**)0, 0)));
#endif
-
- return 0;
}
diff --git a/libcxx/test/std/depr/depr.c.headers/locale_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/locale_h.compile.pass.cpp
index 5b87cf29fcdc5..d0e6420593226 100644
--- a/libcxx/test/std/depr/depr.c.headers/locale_h.compile.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/locale_h.compile.pass.cpp
@@ -11,7 +11,8 @@
// <locale.h>
#include <locale.h>
-#include <type_traits>
+
+#include "test_macros.h"
#ifndef LC_ALL
#error LC_ALL not defined
@@ -42,5 +43,5 @@
#endif
lconv lc;
-static_assert((std::is_same<decltype(setlocale(0, "")), char*>::value), "");
-static_assert((std::is_same<decltype(localeconv()), lconv*>::value), "");
+ASSERT_SAME_TYPE(char*, decltype(setlocale(0, "")));
+ASSERT_SAME_TYPE(lconv*, decltype(localeconv()));
diff --git a/libcxx/test/std/depr/depr.c.headers/math_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/math_h.pass.cpp
index 8ce3b0816d518..87767a2ee4311 100644
--- a/libcxx/test/std/depr/depr.c.headers/math_h.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/math_h.pass.cpp
@@ -107,26 +107,19 @@ std::false_type has_abs_imp(...);
template <class T>
struct has_abs : decltype(has_abs_imp<T>(0)) {};
-void test_abs()
-{
+void test_abs() {
TEST_DIAGNOSTIC_PUSH
TEST_CLANG_DIAGNOSTIC_IGNORED("-Wabsolute-value")
- static_assert((std::is_same<decltype(abs((float)0)), float>::value), "");
- static_assert((std::is_same<decltype(abs((double)0)), double>::value), "");
- static_assert(
- (std::is_same<decltype(abs((long double)0)), long double>::value), "");
- static_assert((std::is_same<decltype(abs((int)0)), int>::value), "");
- static_assert((std::is_same<decltype(abs((long)0)), long>::value), "");
- static_assert((std::is_same<decltype(abs((long long)0)), long long>::value),
- "");
- static_assert((std::is_same<decltype(abs((unsigned char)0)), int>::value),
- "");
- static_assert((std::is_same<decltype(abs((unsigned short)0)), int>::value),
- "");
-
- static_assert((std::is_same<decltype(abs(Ambiguous())), Ambiguous>::value),
- "");
+ ASSERT_SAME_TYPE(decltype(abs((float)0)), float);
+ ASSERT_SAME_TYPE(decltype(abs((double)0)), double);
+ ASSERT_SAME_TYPE(decltype(abs((long double)0)), long double);
+ ASSERT_SAME_TYPE(decltype(abs((int)0)), int);
+ ASSERT_SAME_TYPE(decltype(abs((long)0)), long);
+ ASSERT_SAME_TYPE(decltype(abs((long long)0)), long long);
+ ASSERT_SAME_TYPE(decltype(abs((unsigned char)0)), int);
+ ASSERT_SAME_TYPE(decltype(abs((unsigned short)0)), int);
+ ASSERT_SAME_TYPE(decltype(abs(Ambiguous())), Ambiguous);
static_assert(!has_abs<unsigned>::value, "");
static_assert(!has_abs<unsigned long>::value, "");
@@ -137,260 +130,231 @@ void test_abs()
assert(abs(-1.) == 1);
}
-void test_acos()
-{
- static_assert((std::is_same<decltype(acosf(0)), float>::value), "");
- static_assert((std::is_same<decltype(acosl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(acos(Ambiguous())), Ambiguous>::value), "");
+void test_acos() {
+ ASSERT_SAME_TYPE(decltype(acosf(0)), float);
+ ASSERT_SAME_TYPE(decltype(acosl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(acos(Ambiguous())), Ambiguous);
assert(acos(1) == 0);
}
-void test_asin()
-{
- static_assert((std::is_same<decltype(asinf(0)), float>::value), "");
- static_assert((std::is_same<decltype(asinl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(asin(Ambiguous())), Ambiguous>::value), "");
+void test_asin() {
+ ASSERT_SAME_TYPE(decltype(asinf(0)), float);
+ ASSERT_SAME_TYPE(decltype(asinl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(asin(Ambiguous())), Ambiguous);
assert(asin(0) == 0);
}
-void test_atan()
-{
- static_assert((std::is_same<decltype(atanf(0)), float>::value), "");
- static_assert((std::is_same<decltype(atanl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(atan(Ambiguous())), Ambiguous>::value), "");
+void test_atan() {
+ ASSERT_SAME_TYPE(decltype(atanf(0)), float);
+ ASSERT_SAME_TYPE(decltype(atanl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(atan(Ambiguous())), Ambiguous);
assert(atan(0) == 0);
}
-void test_atan2()
-{
- static_assert((std::is_same<decltype(atan2f(0,0)), float>::value), "");
- static_assert((std::is_same<decltype(atan2l(0,0)), long double>::value), "");
- static_assert((std::is_same<decltype(atan2(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+void test_atan2() {
+ ASSERT_SAME_TYPE(decltype(atan2f(0,0)), float);
+ ASSERT_SAME_TYPE(decltype(atan2l(0,0)), long double);
+ ASSERT_SAME_TYPE(decltype(atan2(Ambiguous(), Ambiguous())), Ambiguous);
assert(atan2(0,1) == 0);
}
-void test_ceil()
-{
- static_assert((std::is_same<decltype(ceilf(0)), float>::value), "");
- static_assert((std::is_same<decltype(ceill(0)), long double>::value), "");
- static_assert((std::is_same<decltype(ceil(Ambiguous())), Ambiguous>::value), "");
+void test_ceil() {
+ ASSERT_SAME_TYPE(decltype(ceilf(0)), float);
+ ASSERT_SAME_TYPE(decltype(ceill(0)), long double);
+ ASSERT_SAME_TYPE(decltype(ceil(Ambiguous())), Ambiguous);
assert(ceil(0) == 0);
}
-void test_cos()
-{
- static_assert((std::is_same<decltype(cosf(0)), float>::value), "");
- static_assert((std::is_same<decltype(cosl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(cos(Ambiguous())), Ambiguous>::value), "");
+void test_cos() {
+ ASSERT_SAME_TYPE(decltype(cosf(0)), float);
+ ASSERT_SAME_TYPE(decltype(cosl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(cos(Ambiguous())), Ambiguous);
assert(cos(0) == 1);
}
-void test_cosh()
-{
- static_assert((std::is_same<decltype(coshf(0)), float>::value), "");
- static_assert((std::is_same<decltype(coshl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(cosh(Ambiguous())), Ambiguous>::value), "");
+void test_cosh() {
+ ASSERT_SAME_TYPE(decltype(coshf(0)), float);
+ ASSERT_SAME_TYPE(decltype(coshl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(cosh(Ambiguous())), Ambiguous);
assert(cosh(0) == 1);
}
-void test_exp()
-{
- static_assert((std::is_same<decltype(expf(0)), float>::value), "");
- static_assert((std::is_same<decltype(expl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(exp(Ambiguous())), Ambiguous>::value), "");
+void test_exp() {
+ ASSERT_SAME_TYPE(decltype(expf(0)), float);
+ ASSERT_SAME_TYPE(decltype(expl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(exp(Ambiguous())), Ambiguous);
assert(exp(0) == 1);
}
-void test_fabs()
-{
- static_assert((std::is_same<decltype(fabsf(0.0f)), float>::value), "");
- static_assert((std::is_same<decltype(fabsl(0.0L)), long double>::value), "");
- static_assert((std::is_same<decltype(fabs(Ambiguous())), Ambiguous>::value), "");
+void test_fabs() {
+ ASSERT_SAME_TYPE(decltype(fabsf(0.0f)), float);
+ ASSERT_SAME_TYPE(decltype(fabsl(0.0L)), long double);
+ ASSERT_SAME_TYPE(decltype(fabs(Ambiguous())), Ambiguous);
assert(fabs(-1) == 1);
}
-void test_floor()
-{
- static_assert((std::is_same<decltype(floorf(0)), float>::value), "");
- static_assert((std::is_same<decltype(floorl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(floor(Ambiguous())), Ambiguous>::value), "");
+void test_floor() {
+ ASSERT_SAME_TYPE(decltype(floorf(0)), float);
+ ASSERT_SAME_TYPE(decltype(floorl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(floor(Ambiguous())), Ambiguous);
assert(floor(1) == 1);
}
-void test_fmod()
-{
- static_assert((std::is_same<decltype(fmodf(0,0)), float>::value), "");
- static_assert((std::is_same<decltype(fmodl(0,0)), long double>::value), "");
- static_assert((std::is_same<decltype(fmod(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+void test_fmod() {
+ ASSERT_SAME_TYPE(decltype(fmodf(0,0)), float);
+ ASSERT_SAME_TYPE(decltype(fmodl(0,0)), long double);
+ ASSERT_SAME_TYPE(decltype(fmod(Ambiguous(), Ambiguous())), Ambiguous);
assert(fmod(1.5,1) == .5);
}
-void test_frexp()
-{
+void test_frexp() {
int ip;
- static_assert((std::is_same<decltype(frexpf(0, &ip)), float>::value), "");
- static_assert((std::is_same<decltype(frexpl(0, &ip)), long double>::value), "");
- static_assert((std::is_same<decltype(frexp(Ambiguous(), &ip)), Ambiguous>::value), "");
+ ASSERT_SAME_TYPE(decltype(frexpf(0, &ip)), float);
+ ASSERT_SAME_TYPE(decltype(frexpl(0, &ip)), long double);
+ ASSERT_SAME_TYPE(decltype(frexp(Ambiguous(), &ip)), Ambiguous);
assert(frexp(0, &ip) == 0);
}
-void test_ldexp()
-{
+void test_ldexp() {
int ip = 1;
- static_assert((std::is_same<decltype(ldexpf(0, ip)), float>::value), "");
- static_assert((std::is_same<decltype(ldexpl(0, ip)), long double>::value), "");
- static_assert((std::is_same<decltype(ldexp(Ambiguous(), ip)), Ambiguous>::value), "");
+ ASSERT_SAME_TYPE(decltype(ldexpf(0, ip)), float);
+ ASSERT_SAME_TYPE(decltype(ldexpl(0, ip)), long double);
+ ASSERT_SAME_TYPE(decltype(ldexp(Ambiguous(), ip)), Ambiguous);
assert(ldexp(1, ip) == 2);
}
-void test_log()
-{
- static_assert((std::is_same<decltype(logf(0)), float>::value), "");
- static_assert((std::is_same<decltype(logl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(log(Ambiguous())), Ambiguous>::value), "");
+void test_log() {
+ ASSERT_SAME_TYPE(decltype(logf(0)), float);
+ ASSERT_SAME_TYPE(decltype(logl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(log(Ambiguous())), Ambiguous);
assert(log(1) == 0);
}
-void test_log10()
-{
- static_assert((std::is_same<decltype(log10f(0)), float>::value), "");
- static_assert((std::is_same<decltype(log10l(0)), long double>::value), "");
- static_assert((std::is_same<decltype(log10(Ambiguous())), Ambiguous>::value), "");
+void test_log10() {
+ ASSERT_SAME_TYPE(decltype(log10f(0)), float);
+ ASSERT_SAME_TYPE(decltype(log10l(0)), long double);
+ ASSERT_SAME_TYPE(decltype(log10(Ambiguous())), Ambiguous);
assert(log10(1) == 0);
}
-void test_modf()
-{
- static_assert((std::is_same<decltype(modf((float)0, (float*)0)), float>::value), "");
- static_assert((std::is_same<decltype(modf((double)0, (double*)0)), double>::value), "");
- static_assert((std::is_same<decltype(modf((long double)0, (long double*)0)), long double>::value), "");
- static_assert((std::is_same<decltype(modff(0, (float*)0)), float>::value), "");
- static_assert((std::is_same<decltype(modfl(0, (long double*)0)), long double>::value), "");
- static_assert((std::is_same<decltype(modf(Ambiguous(), (Ambiguous*)0)), Ambiguous>::value), "");
+void test_modf() {
+ ASSERT_SAME_TYPE(decltype(modf((float)0, (float*)0)), float);
+ ASSERT_SAME_TYPE(decltype(modf((double)0, (double*)0)), double);
+ ASSERT_SAME_TYPE(decltype(modf((long double)0, (long double*)0)), long double);
+ ASSERT_SAME_TYPE(decltype(modff(0, (float*)0)), float);
+ ASSERT_SAME_TYPE(decltype(modfl(0, (long double*)0)), long double);
+ ASSERT_SAME_TYPE(decltype(modf(Ambiguous(), (Ambiguous*)0)), Ambiguous);
double i;
assert(modf(1., &i) == 0);
}
-void test_pow()
-{
- static_assert((std::is_same<decltype(powf(0,0)), float>::value), "");
- static_assert((std::is_same<decltype(powl(0,0)), long double>::value), "");
- static_assert((std::is_same<decltype(pow((int)0, (int)0)), double>::value), "");
-// static_assert((std::is_same<decltype(pow(Value<int>(), (int)0)), double>::value), "");
-// static_assert((std::is_same<decltype(pow(Value<long double>(), (float)0)), long double>::value), "");
-// static_assert((std::is_same<decltype(pow((float) 0, Value<float>())), float>::value), "");
- static_assert((std::is_same<decltype(pow(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+void test_pow() {
+ ASSERT_SAME_TYPE(decltype(powf(0,0)), float);
+ ASSERT_SAME_TYPE(decltype(powl(0,0)), long double);
+ ASSERT_SAME_TYPE(decltype(pow((int)0, (int)0)), double);
+ // ASSERT_SAME_TYPE(decltype(pow(Value<int>(), (int)0)), double);
+ // ASSERT_SAME_TYPE(decltype(pow(Value<long double>(), (float)0)), long double);
+ // ASSERT_SAME_TYPE(decltype(pow((float) 0, Value<float>())), float);
+ ASSERT_SAME_TYPE(decltype(pow(Ambiguous(), Ambiguous())), Ambiguous);
assert(pow(1,1) == 1);
-// assert(pow(Value<int,1>(), Value<float,1>()) == 1);
-// assert(pow(1.0f, Value<double,1>()) == 1);
-// assert(pow(1.0, Value<int,1>()) == 1);
-// assert(pow(Value<long double,1>(), 1LL) == 1);
+ // assert(pow(Value<int,1>(), Value<float,1>()) == 1);
+ // assert(pow(1.0f, Value<double,1>()) == 1);
+ // assert(pow(1.0, Value<int,1>()) == 1);
+ // assert(pow(Value<long double,1>(), 1LL) == 1);
}
-void test_sin()
-{
- static_assert((std::is_same<decltype(sinf(0)), float>::value), "");
- static_assert((std::is_same<decltype(sinl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(sin(Ambiguous())), Ambiguous>::value), "");
+void test_sin() {
+ ASSERT_SAME_TYPE(decltype(sinf(0)), float);
+ ASSERT_SAME_TYPE(decltype(sinl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(sin(Ambiguous())), Ambiguous);
assert(sin(0) == 0);
}
-void test_sinh()
-{
- static_assert((std::is_same<decltype(sinhf(0)), float>::value), "");
- static_assert((std::is_same<decltype(sinhl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(sinh(Ambiguous())), Ambiguous>::value), "");
+void test_sinh() {
+ ASSERT_SAME_TYPE(decltype(sinhf(0)), float);
+ ASSERT_SAME_TYPE(decltype(sinhl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(sinh(Ambiguous())), Ambiguous);
assert(sinh(0) == 0);
}
-void test_sqrt()
-{
- static_assert((std::is_same<decltype(sqrtf(0)), float>::value), "");
- static_assert((std::is_same<decltype(sqrtl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(sqrt(Ambiguous())), Ambiguous>::value), "");
+void test_sqrt() {
+ ASSERT_SAME_TYPE(decltype(sqrtf(0)), float);
+ ASSERT_SAME_TYPE(decltype(sqrtl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(sqrt(Ambiguous())), Ambiguous);
assert(sqrt(4) == 2);
}
-void test_tan()
-{
- static_assert((std::is_same<decltype(tanf(0)), float>::value), "");
- static_assert((std::is_same<decltype(tanl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(tan(Ambiguous())), Ambiguous>::value), "");
+void test_tan() {
+ ASSERT_SAME_TYPE(decltype(tanf(0)), float);
+ ASSERT_SAME_TYPE(decltype(tanl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(tan(Ambiguous())), Ambiguous);
assert(tan(0) == 0);
}
-void test_tanh()
-{
- static_assert((std::is_same<decltype(tanhf(0)), float>::value), "");
- static_assert((std::is_same<decltype(tanhl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(tanh(Ambiguous())), Ambiguous>::value), "");
+void test_tanh() {
+ ASSERT_SAME_TYPE(decltype(tanhf(0)), float);
+ ASSERT_SAME_TYPE(decltype(tanhl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(tanh(Ambiguous())), Ambiguous);
assert(tanh(0) == 0);
}
-void test_signbit()
-{
+void test_signbit() {
#ifdef signbit
#error signbit defined
#endif
- static_assert((std::is_same<decltype(signbit(Ambiguous())), Ambiguous>::value), "");
+ ASSERT_SAME_TYPE(decltype(signbit(Ambiguous())), Ambiguous);
assert(signbit(-1.0) == true);
}
-void test_fpclassify()
-{
+void test_fpclassify() {
#ifdef fpclassify
#error fpclassify defined
#endif
- static_assert((std::is_same<decltype(fpclassify(Ambiguous())), Ambiguous>::value), "");
+ ASSERT_SAME_TYPE(decltype(fpclassify(Ambiguous())), Ambiguous);
assert(fpclassify(-1.0) == FP_NORMAL);
}
-void test_isfinite()
-{
+void test_isfinite() {
#ifdef isfinite
#error isfinite defined
#endif
- static_assert((std::is_same<decltype(isfinite(Ambiguous())), Ambiguous>::value), "");
+ ASSERT_SAME_TYPE(decltype(isfinite(Ambiguous())), Ambiguous);
assert(isfinite(-1.0) == true);
}
-void test_isnormal()
-{
+void test_isnormal() {
#ifdef isnormal
#error isnormal defined
#endif
- static_assert((std::is_same<decltype(isnormal(Ambiguous())), Ambiguous>::value), "");
+ ASSERT_SAME_TYPE(decltype(isnormal(Ambiguous())), Ambiguous);
assert(isnormal(-1.0) == true);
}
-void test_isgreater()
-{
+void test_isgreater() {
#ifdef isgreater
#error isgreater defined
#endif
- static_assert((std::is_same<decltype(isgreater(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+ ASSERT_SAME_TYPE(decltype(isgreater(Ambiguous(), Ambiguous())), Ambiguous);
assert(isgreater(-1.0, 0.F) == false);
}
-void test_isgreaterequal()
-{
+void test_isgreaterequal() {
#ifdef isgreaterequal
#error isgreaterequal defined
#endif
- static_assert((std::is_same<decltype(isgreaterequal(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+ ASSERT_SAME_TYPE(decltype(isgreaterequal(Ambiguous(), Ambiguous())), Ambiguous);
assert(isgreaterequal(-1.0, 0.F) == false);
}
-void test_isinf()
-{
+void test_isinf() {
#ifdef isinf
#error isinf defined
#endif
- static_assert((std::is_same<decltype(isinf((float)0)), bool>::value), "");
+ ASSERT_SAME_TYPE(decltype(isinf((float)0)), bool);
typedef decltype(isinf((double)0)) DoubleRetType;
#ifndef __linux__
- static_assert((std::is_same<DoubleRetType, bool>::value), "");
+ ASSERT_SAME_TYPE(DoubleRetType, bool);
#else
// GLIBC < 2.26 defines 'isinf(double)' with a return type of 'int' in
// all C++ dialects. The test should tolerate this.
@@ -399,48 +363,44 @@ void test_isinf()
|| std::is_same<DoubleRetType, int>::value), "");
#endif
- static_assert((std::is_same<decltype(isinf(0)), bool>::value), "");
- static_assert((std::is_same<decltype(isinf((long double)0)), bool>::value), "");
+ ASSERT_SAME_TYPE(decltype(isinf(0)), bool);
+ ASSERT_SAME_TYPE(decltype(isinf((long double)0)), bool);
assert(isinf(-1.0) == false);
}
-void test_isless()
-{
+void test_isless() {
#ifdef isless
#error isless defined
#endif
- static_assert((std::is_same<decltype(isless(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+ ASSERT_SAME_TYPE(decltype(isless(Ambiguous(), Ambiguous())), Ambiguous);
assert(isless(-1.0, 0.F) == true);
}
-void test_islessequal()
-{
+void test_islessequal() {
#ifdef islessequal
#error islessequal defined
#endif
- static_assert((std::is_same<decltype(islessequal(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+ ASSERT_SAME_TYPE(decltype(islessequal(Ambiguous(), Ambiguous())), Ambiguous);
assert(islessequal(-1.0, 0.F) == true);
}
-void test_islessgreater()
-{
+void test_islessgreater() {
#ifdef islessgreater
#error islessgreater defined
#endif
- static_assert((std::is_same<decltype(islessgreater(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+ ASSERT_SAME_TYPE(decltype(islessgreater(Ambiguous(), Ambiguous())), Ambiguous);
assert(islessgreater(-1.0, 0.F) == true);
}
-void test_isnan()
-{
+void test_isnan() {
#ifdef isnan
#error isnan defined
#endif
- static_assert((std::is_same<decltype(isnan((float)0)), bool>::value), "");
+ ASSERT_SAME_TYPE(decltype(isnan((float)0)), bool);
typedef decltype(isnan((double)0)) DoubleRetType;
#ifndef __linux__
- static_assert((std::is_same<DoubleRetType, bool>::value), "");
+ ASSERT_SAME_TYPE(DoubleRetType, bool);
#else
// GLIBC < 2.26 defines 'isnan(double)' with a return type of 'int' in
// all C++ dialects. The test should tolerate this.
@@ -449,353 +409,316 @@ void test_isnan()
|| std::is_same<DoubleRetType, int>::value), "");
#endif
- static_assert((std::is_same<decltype(isnan(0)), bool>::value), "");
- static_assert((std::is_same<decltype(isnan((long double)0)), bool>::value), "");
+ ASSERT_SAME_TYPE(decltype(isnan(0)), bool);
+ ASSERT_SAME_TYPE(decltype(isnan((long double)0)), bool);
assert(isnan(-1.0) == false);
}
-void test_isunordered()
-{
+void test_isunordered() {
#ifdef isunordered
#error isunordered defined
#endif
- static_assert((std::is_same<decltype(isunordered(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+ ASSERT_SAME_TYPE(decltype(isunordered(Ambiguous(), Ambiguous())), Ambiguous);
assert(isunordered(-1.0, 0.F) == false);
}
-void test_acosh()
-{
- static_assert((std::is_same<decltype(acoshf(0)), float>::value), "");
- static_assert((std::is_same<decltype(acoshl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(acosh(Ambiguous())), Ambiguous>::value), "");
+void test_acosh() {
+ ASSERT_SAME_TYPE(decltype(acoshf(0)), float);
+ ASSERT_SAME_TYPE(decltype(acoshl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(acosh(Ambiguous())), Ambiguous);
assert(acosh(1) == 0);
}
-void test_asinh()
-{
- static_assert((std::is_same<decltype(asinhf(0)), float>::value), "");
- static_assert((std::is_same<decltype(asinhl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(asinh(Ambiguous())), Ambiguous>::value), "");
+void test_asinh() {
+ ASSERT_SAME_TYPE(decltype(asinhf(0)), float);
+ ASSERT_SAME_TYPE(decltype(asinhl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(asinh(Ambiguous())), Ambiguous);
assert(asinh(0) == 0);
}
-void test_atanh()
-{
- static_assert((std::is_same<decltype(atanhf(0)), float>::value), "");
- static_assert((std::is_same<decltype(atanhl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(atanh(Ambiguous())), Ambiguous>::value), "");
+void test_atanh() {
+ ASSERT_SAME_TYPE(decltype(atanhf(0)), float);
+ ASSERT_SAME_TYPE(decltype(atanhl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(atanh(Ambiguous())), Ambiguous);
assert(atanh(0) == 0);
}
void test_cbrt() {
- static_assert((std::is_same<decltype(cbrtf(0)), float>::value), "");
- static_assert((std::is_same<decltype(cbrtl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(cbrt(Ambiguous())), Ambiguous>::value),
- "");
+ ASSERT_SAME_TYPE(decltype(cbrtf(0)), float);
+ ASSERT_SAME_TYPE(decltype(cbrtl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(cbrt(Ambiguous())), Ambiguous);
assert(truncate_fp(cbrt(1)) == 1);
-
}
-void test_copysign()
-{
- static_assert((std::is_same<decltype(copysignf(0,0)), float>::value), "");
- static_assert((std::is_same<decltype(copysignl(0,0)), long double>::value), "");
- static_assert((std::is_same<decltype(copysign((int)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(copysign(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+void test_copysign() {
+ ASSERT_SAME_TYPE(decltype(copysignf(0,0)), float);
+ ASSERT_SAME_TYPE(decltype(copysignl(0,0)), long double);
+ ASSERT_SAME_TYPE(decltype(copysign((int)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(copysign(Ambiguous(), Ambiguous())), Ambiguous);
assert(copysign(1,1) == 1);
}
-void test_erf()
-{
- static_assert((std::is_same<decltype(erff(0)), float>::value), "");
- static_assert((std::is_same<decltype(erfl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(erf(Ambiguous())), Ambiguous>::value), "");
+void test_erf() {
+ ASSERT_SAME_TYPE(decltype(erff(0)), float);
+ ASSERT_SAME_TYPE(decltype(erfl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(erf(Ambiguous())), Ambiguous);
assert(erf(0) == 0);
}
-void test_erfc()
-{
- static_assert((std::is_same<decltype(erfcf(0)), float>::value), "");
- static_assert((std::is_same<decltype(erfcl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(erfc(Ambiguous())), Ambiguous>::value), "");
+void test_erfc() {
+ ASSERT_SAME_TYPE(decltype(erfcf(0)), float);
+ ASSERT_SAME_TYPE(decltype(erfcl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(erfc(Ambiguous())), Ambiguous);
assert(erfc(0) == 1);
}
-void test_exp2()
-{
- static_assert((std::is_same<decltype(exp2f(0)), float>::value), "");
- static_assert((std::is_same<decltype(exp2l(0)), long double>::value), "");
- static_assert((std::is_same<decltype(exp2(Ambiguous())), Ambiguous>::value), "");
+void test_exp2() {
+ ASSERT_SAME_TYPE(decltype(exp2f(0)), float);
+ ASSERT_SAME_TYPE(decltype(exp2l(0)), long double);
+ ASSERT_SAME_TYPE(decltype(exp2(Ambiguous())), Ambiguous);
assert(exp2(1) == 2);
}
-void test_expm1()
-{
- static_assert((std::is_same<decltype(expm1f(0)), float>::value), "");
- static_assert((std::is_same<decltype(expm1l(0)), long double>::value), "");
- static_assert((std::is_same<decltype(expm1(Ambiguous())), Ambiguous>::value), "");
+void test_expm1() {
+ ASSERT_SAME_TYPE(decltype(expm1f(0)), float);
+ ASSERT_SAME_TYPE(decltype(expm1l(0)), long double);
+ ASSERT_SAME_TYPE(decltype(expm1(Ambiguous())), Ambiguous);
assert(expm1(0) == 0);
}
-void test_fdim()
-{
- static_assert((std::is_same<decltype(fdimf(0,0)), float>::value), "");
- static_assert((std::is_same<decltype(fdiml(0,0)), long double>::value), "");
- static_assert((std::is_same<decltype(fdim((int)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(fdim(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+void test_fdim() {
+ ASSERT_SAME_TYPE(decltype(fdimf(0,0)), float);
+ ASSERT_SAME_TYPE(decltype(fdiml(0,0)), long double);
+ ASSERT_SAME_TYPE(decltype(fdim((int)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(fdim(Ambiguous(), Ambiguous())), Ambiguous);
assert(fdim(1,0) == 1);
}
-void test_fma()
-{
- static_assert((std::is_same<decltype(fma((bool)0, (float)0, (float)0)), double>::value), "");
- static_assert((std::is_same<decltype(fma((float)0, (float)0, (double)0)), double>::value), "");
- static_assert((std::is_same<decltype(fma((float)0, (float)0, (long double)0)), long double>::value), "");
- static_assert((std::is_same<decltype(fma((float)0, (float)0, (float)0)), float>::value), "");
+void test_fma() {
+ ASSERT_SAME_TYPE(decltype(fma((bool)0, (float)0, (float)0)), double);
+ ASSERT_SAME_TYPE(decltype(fma((float)0, (float)0, (double)0)), double);
+ ASSERT_SAME_TYPE(decltype(fma((float)0, (float)0, (long double)0)), long double);
+ ASSERT_SAME_TYPE(decltype(fma((float)0, (float)0, (float)0)), float);
- static_assert((std::is_same<decltype(fma((bool)0, (double)0, (double)0)), double>::value), "");
- static_assert((std::is_same<decltype(fma((double)0, (double)0, (float)0)), double>::value), "");
- static_assert((std::is_same<decltype(fma((double)0, (double)0, (long double)0)), long double>::value), "");
- static_assert((std::is_same<decltype(fma((double)0, (double)0, (double)0)), double>::value), "");
+ ASSERT_SAME_TYPE(decltype(fma((bool)0, (double)0, (double)0)), double);
+ ASSERT_SAME_TYPE(decltype(fma((double)0, (double)0, (float)0)), double);
+ ASSERT_SAME_TYPE(decltype(fma((double)0, (double)0, (long double)0)), long double);
+ ASSERT_SAME_TYPE(decltype(fma((double)0, (double)0, (double)0)), double);
- static_assert((std::is_same<decltype(fma((long double)0, (long double)0, (float)0)), long double>::value), "");
- static_assert((std::is_same<decltype(fma((double)0, (long double)0, (long double)0)), long double>::value), "");
- static_assert((std::is_same<decltype(fma((long double)0, (long double)0, (long double)0)), long double>::value), "");
+ ASSERT_SAME_TYPE(decltype(fma((long double)0, (long double)0, (float)0)), long double);
+ ASSERT_SAME_TYPE(decltype(fma((double)0, (long double)0, (long double)0)), long double);
+ ASSERT_SAME_TYPE(decltype(fma((long double)0, (long double)0, (long double)0)), long double);
- static_assert((std::is_same<decltype(fmaf(0,0,0)), float>::value), "");
- static_assert((std::is_same<decltype(fmal(0,0,0)), long double>::value), "");
- static_assert((std::is_same<decltype(fma(Ambiguous(), Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+ ASSERT_SAME_TYPE(decltype(fmaf(0,0,0)), float);
+ ASSERT_SAME_TYPE(decltype(fmal(0,0,0)), long double);
+ ASSERT_SAME_TYPE(decltype(fma(Ambiguous(), Ambiguous(), Ambiguous())), Ambiguous);
assert(fma(1,1,1) == 2);
}
-void test_fmax()
-{
- static_assert((std::is_same<decltype(fmaxf(0,0)), float>::value), "");
- static_assert((std::is_same<decltype(fmaxl(0,0)), long double>::value), "");
- static_assert((std::is_same<decltype(fmax((int)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(fmax(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+void test_fmax() {
+ ASSERT_SAME_TYPE(decltype(fmaxf(0,0)), float);
+ ASSERT_SAME_TYPE(decltype(fmaxl(0,0)), long double);
+ ASSERT_SAME_TYPE(decltype(fmax((int)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(fmax(Ambiguous(), Ambiguous())), Ambiguous);
assert(fmax(1,0) == 1);
}
-void test_fmin()
-{
- static_assert((std::is_same<decltype(fminf(0,0)), float>::value), "");
- static_assert((std::is_same<decltype(fminl(0,0)), long double>::value), "");
- static_assert((std::is_same<decltype(fmin((int)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(fmin(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+void test_fmin() {
+ ASSERT_SAME_TYPE(decltype(fminf(0,0)), float);
+ ASSERT_SAME_TYPE(decltype(fminl(0,0)), long double);
+ ASSERT_SAME_TYPE(decltype(fmin((int)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(fmin(Ambiguous(), Ambiguous())), Ambiguous);
assert(fmin(1,0) == 0);
}
-void test_hypot()
-{
- static_assert((std::is_same<decltype(hypotf(0,0)), float>::value), "");
- static_assert((std::is_same<decltype(hypotl(0,0)), long double>::value), "");
- static_assert((std::is_same<decltype(hypot((int)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(hypot(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+void test_hypot() {
+ ASSERT_SAME_TYPE(decltype(hypotf(0,0)), float);
+ ASSERT_SAME_TYPE(decltype(hypotl(0,0)), long double);
+ ASSERT_SAME_TYPE(decltype(hypot((int)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(hypot(Ambiguous(), Ambiguous())), Ambiguous);
assert(hypot(3,4) == 5);
}
-void test_ilogb()
-{
- static_assert((std::is_same<decltype(ilogbf(0)), int>::value), "");
- static_assert((std::is_same<decltype(ilogbl(0)), int>::value), "");
- static_assert((std::is_same<decltype(ilogb(Ambiguous())), Ambiguous>::value), "");
+void test_ilogb() {
+ ASSERT_SAME_TYPE(decltype(ilogbf(0)), int);
+ ASSERT_SAME_TYPE(decltype(ilogbl(0)), int);
+ ASSERT_SAME_TYPE(decltype(ilogb(Ambiguous())), Ambiguous);
assert(ilogb(1) == 0);
}
-void test_lgamma()
-{
- static_assert((std::is_same<decltype(lgammaf(0)), float>::value), "");
- static_assert((std::is_same<decltype(lgammal(0)), long double>::value), "");
- static_assert((std::is_same<decltype(lgamma(Ambiguous())), Ambiguous>::value), "");
+void test_lgamma() {
+ ASSERT_SAME_TYPE(decltype(lgammaf(0)), float);
+ ASSERT_SAME_TYPE(decltype(lgammal(0)), long double);
+ ASSERT_SAME_TYPE(decltype(lgamma(Ambiguous())), Ambiguous);
assert(lgamma(1) == 0);
}
-void test_llrint()
-{
- static_assert((std::is_same<decltype(llrintf(0)), long long>::value), "");
- static_assert((std::is_same<decltype(llrintl(0)), long long>::value), "");
- static_assert((std::is_same<decltype(llrint(Ambiguous())), Ambiguous>::value), "");
+void test_llrint() {
+ ASSERT_SAME_TYPE(decltype(llrintf(0)), long long);
+ ASSERT_SAME_TYPE(decltype(llrintl(0)), long long);
+ ASSERT_SAME_TYPE(decltype(llrint(Ambiguous())), Ambiguous);
assert(llrint(1) == 1LL);
}
-void test_llround()
-{
- static_assert((std::is_same<decltype(llroundf(0)), long long>::value), "");
- static_assert((std::is_same<decltype(llroundl(0)), long long>::value), "");
- static_assert((std::is_same<decltype(llround(Ambiguous())), Ambiguous>::value), "");
+void test_llround() {
+ ASSERT_SAME_TYPE(decltype(llroundf(0)), long long);
+ ASSERT_SAME_TYPE(decltype(llroundl(0)), long long);
+ ASSERT_SAME_TYPE(decltype(llround(Ambiguous())), Ambiguous);
assert(llround(1) == 1LL);
}
-void test_log1p()
-{
- static_assert((std::is_same<decltype(log1pf(0)), float>::value), "");
- static_assert((std::is_same<decltype(log1pl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(log1p(Ambiguous())), Ambiguous>::value), "");
+void test_log1p() {
+ ASSERT_SAME_TYPE(decltype(log1pf(0)), float);
+ ASSERT_SAME_TYPE(decltype(log1pl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(log1p(Ambiguous())), Ambiguous);
assert(log1p(0) == 0);
}
-void test_log2()
-{
- static_assert((std::is_same<decltype(log2f(0)), float>::value), "");
- static_assert((std::is_same<decltype(log2l(0)), long double>::value), "");
- static_assert((std::is_same<decltype(log2(Ambiguous())), Ambiguous>::value), "");
+void test_log2() {
+ ASSERT_SAME_TYPE(decltype(log2f(0)), float);
+ ASSERT_SAME_TYPE(decltype(log2l(0)), long double);
+ ASSERT_SAME_TYPE(decltype(log2(Ambiguous())), Ambiguous);
assert(log2(1) == 0);
}
-void test_logb()
-{
- static_assert((std::is_same<decltype(logbf(0)), float>::value), "");
- static_assert((std::is_same<decltype(logbl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(logb(Ambiguous())), Ambiguous>::value), "");
+void test_logb() {
+ ASSERT_SAME_TYPE(decltype(logbf(0)), float);
+ ASSERT_SAME_TYPE(decltype(logbl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(logb(Ambiguous())), Ambiguous);
assert(logb(1) == 0);
}
-void test_lrint()
-{
- static_assert((std::is_same<decltype(lrintf(0)), long>::value), "");
- static_assert((std::is_same<decltype(lrintl(0)), long>::value), "");
- static_assert((std::is_same<decltype(lrint(Ambiguous())), Ambiguous>::value), "");
+void test_lrint() {
+ ASSERT_SAME_TYPE(decltype(lrintf(0)), long);
+ ASSERT_SAME_TYPE(decltype(lrintl(0)), long);
+ ASSERT_SAME_TYPE(decltype(lrint(Ambiguous())), Ambiguous);
assert(lrint(1) == 1L);
}
-void test_lround()
-{
- static_assert((std::is_same<decltype(lroundf(0)), long>::value), "");
- static_assert((std::is_same<decltype(lroundl(0)), long>::value), "");
- static_assert((std::is_same<decltype(lround(Ambiguous())), Ambiguous>::value), "");
+void test_lround() {
+ ASSERT_SAME_TYPE(decltype(lroundf(0)), long);
+ ASSERT_SAME_TYPE(decltype(lroundl(0)), long);
+ ASSERT_SAME_TYPE(decltype(lround(Ambiguous())), Ambiguous);
assert(lround(1) == 1L);
}
-void test_nan()
-{
- static_assert((std::is_same<decltype(nan("")), double>::value), "");
- static_assert((std::is_same<decltype(nanf("")), float>::value), "");
- static_assert((std::is_same<decltype(nanl("")), long double>::value), "");
+void test_nan() {
+ ASSERT_SAME_TYPE(decltype(nan("")), double);
+ ASSERT_SAME_TYPE(decltype(nanf("")), float);
+ ASSERT_SAME_TYPE(decltype(nanl("")), long double);
}
-void test_nearbyint()
-{
- static_assert((std::is_same<decltype(nearbyintf(0)), float>::value), "");
- static_assert((std::is_same<decltype(nearbyintl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(nearbyint(Ambiguous())), Ambiguous>::value), "");
+void test_nearbyint() {
+ ASSERT_SAME_TYPE(decltype(nearbyintf(0)), float);
+ ASSERT_SAME_TYPE(decltype(nearbyintl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(nearbyint(Ambiguous())), Ambiguous);
assert(nearbyint(1) == 1);
}
-void test_nextafter()
-{
- static_assert((std::is_same<decltype(nextafterf(0,0)), float>::value), "");
- static_assert((std::is_same<decltype(nextafterl(0,0)), long double>::value), "");
- static_assert((std::is_same<decltype(nextafter((int)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(nextafter(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+void test_nextafter() {
+ ASSERT_SAME_TYPE(decltype(nextafterf(0,0)), float);
+ ASSERT_SAME_TYPE(decltype(nextafterl(0,0)), long double);
+ ASSERT_SAME_TYPE(decltype(nextafter((int)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(nextafter(Ambiguous(), Ambiguous())), Ambiguous);
assert(nextafter(0,1) == hexfloat<double>(0x1, 0, -1074));
}
-void test_nexttoward()
-{
- static_assert((std::is_same<decltype(nexttoward((float)0, (long double)0)), float>::value), "");
- static_assert((std::is_same<decltype(nexttoward((bool)0, (long double)0)), double>::value), "");
- static_assert((std::is_same<decltype(nexttoward((unsigned short)0, (long double)0)), double>::value), "");
- static_assert((std::is_same<decltype(nexttoward((int)0, (long double)0)), double>::value), "");
- static_assert((std::is_same<decltype(nexttoward((unsigned int)0, (long double)0)), double>::value), "");
- static_assert((std::is_same<decltype(nexttoward((long)0, (long double)0)), double>::value), "");
- static_assert((std::is_same<decltype(nexttoward((unsigned long)0, (long double)0)), double>::value), "");
- static_assert((std::is_same<decltype(nexttoward((long long)0, (long double)0)), double>::value), "");
- static_assert((std::is_same<decltype(nexttoward((unsigned long long)0, (long double)0)), double>::value), "");
- static_assert((std::is_same<decltype(nexttoward((double)0, (long double)0)), double>::value), "");
- static_assert((std::is_same<decltype(nexttoward((long double)0, (long double)0)), long double>::value), "");
- static_assert((std::is_same<decltype(nexttowardf(0, (long double)0)), float>::value), "");
- static_assert((std::is_same<decltype(nexttowardl(0, (long double)0)), long double>::value), "");
- static_assert((std::is_same<decltype(nexttoward(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+void test_nexttoward() {
+ ASSERT_SAME_TYPE(decltype(nexttoward((float)0, (long double)0)), float);
+ ASSERT_SAME_TYPE(decltype(nexttoward((bool)0, (long double)0)), double);
+ ASSERT_SAME_TYPE(decltype(nexttoward((unsigned short)0, (long double)0)), double);
+ ASSERT_SAME_TYPE(decltype(nexttoward((int)0, (long double)0)), double);
+ ASSERT_SAME_TYPE(decltype(nexttoward((unsigned int)0, (long double)0)), double);
+ ASSERT_SAME_TYPE(decltype(nexttoward((long)0, (long double)0)), double);
+ ASSERT_SAME_TYPE(decltype(nexttoward((unsigned long)0, (long double)0)), double);
+ ASSERT_SAME_TYPE(decltype(nexttoward((long long)0, (long double)0)), double);
+ ASSERT_SAME_TYPE(decltype(nexttoward((unsigned long long)0, (long double)0)), double);
+ ASSERT_SAME_TYPE(decltype(nexttoward((double)0, (long double)0)), double);
+ ASSERT_SAME_TYPE(decltype(nexttoward((long double)0, (long double)0)), long double);
+ ASSERT_SAME_TYPE(decltype(nexttowardf(0, (long double)0)), float);
+ ASSERT_SAME_TYPE(decltype(nexttowardl(0, (long double)0)), long double);
+ ASSERT_SAME_TYPE(decltype(nexttoward(Ambiguous(), Ambiguous())), Ambiguous);
assert(nexttoward(0, 1) == hexfloat<double>(0x1, 0, -1074));
}
-void test_remainder()
-{
- static_assert((std::is_same<decltype(remainderf(0,0)), float>::value), "");
- static_assert((std::is_same<decltype(remainderl(0,0)), long double>::value), "");
- static_assert((std::is_same<decltype(remainder((int)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(remainder(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+void test_remainder() {
+ ASSERT_SAME_TYPE(decltype(remainderf(0,0)), float);
+ ASSERT_SAME_TYPE(decltype(remainderl(0,0)), long double);
+ ASSERT_SAME_TYPE(decltype(remainder((int)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(remainder(Ambiguous(), Ambiguous())), Ambiguous);
assert(remainder(0.5,1) == 0.5);
}
-void test_remquo()
-{
+void test_remquo() {
int ip;
- static_assert((std::is_same<decltype(remquof(0,0, &ip)), float>::value), "");
- static_assert((std::is_same<decltype(remquol(0,0, &ip)), long double>::value), "");
- static_assert((std::is_same<decltype(remquo((int)0, (int)0, &ip)), double>::value), "");
- static_assert((std::is_same<decltype(remquo(Ambiguous(), Ambiguous(), &ip)), Ambiguous>::value), "");
+ ASSERT_SAME_TYPE(decltype(remquof(0,0, &ip)), float);
+ ASSERT_SAME_TYPE(decltype(remquol(0,0, &ip)), long double);
+ ASSERT_SAME_TYPE(decltype(remquo((int)0, (int)0, &ip)), double);
+ ASSERT_SAME_TYPE(decltype(remquo(Ambiguous(), Ambiguous(), &ip)), Ambiguous);
assert(remquo(0.5,1, &ip) == 0.5);
}
-void test_rint()
-{
- static_assert((std::is_same<decltype(rintf(0)), float>::value), "");
- static_assert((std::is_same<decltype(rintl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(rint(Ambiguous())), Ambiguous>::value), "");
+void test_rint() {
+ ASSERT_SAME_TYPE(decltype(rintf(0)), float);
+ ASSERT_SAME_TYPE(decltype(rintl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(rint(Ambiguous())), Ambiguous);
assert(rint(1) == 1);
}
-void test_round()
-{
- static_assert((std::is_same<decltype(roundf(0)), float>::value), "");
- static_assert((std::is_same<decltype(roundl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(round(Ambiguous())), Ambiguous>::value), "");
+void test_round() {
+ ASSERT_SAME_TYPE(decltype(roundf(0)), float);
+ ASSERT_SAME_TYPE(decltype(roundl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(round(Ambiguous())), Ambiguous);
assert(round(1) == 1);
}
-void test_scalbln()
-{
- static_assert((std::is_same<decltype(scalbln((float)0, (long)0)), float>::value), "");
- static_assert((std::is_same<decltype(scalbln((bool)0, (long)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbln((unsigned short)0, (long)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbln((int)0, (long)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbln((unsigned int)0, (long)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbln((long)0, (long)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbln((unsigned long)0, (long)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbln((long long)0, (long)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbln((unsigned long long)0, (long)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbln((double)0, (long)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbln((long double)0, (long)0)), long double>::value), "");
- static_assert((std::is_same<decltype(scalblnf(0, (long)0)), float>::value), "");
- static_assert((std::is_same<decltype(scalblnl(0, (long)0)), long double>::value), "");
- static_assert((std::is_same<decltype(scalbln(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+void test_scalbln() {
+ ASSERT_SAME_TYPE(decltype(scalbln((float)0, (long)0)), float);
+ ASSERT_SAME_TYPE(decltype(scalbln((bool)0, (long)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbln((unsigned short)0, (long)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbln((int)0, (long)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbln((unsigned int)0, (long)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbln((long)0, (long)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbln((unsigned long)0, (long)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbln((long long)0, (long)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbln((unsigned long long)0, (long)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbln((double)0, (long)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbln((long double)0, (long)0)), long double);
+ ASSERT_SAME_TYPE(decltype(scalblnf(0, (long)0)), float);
+ ASSERT_SAME_TYPE(decltype(scalblnl(0, (long)0)), long double);
+ ASSERT_SAME_TYPE(decltype(scalbln(Ambiguous(), Ambiguous())), Ambiguous);
assert(scalbln(1, 1) == 2);
}
-void test_scalbn()
-{
- static_assert((std::is_same<decltype(scalbn((float)0, (int)0)), float>::value), "");
- static_assert((std::is_same<decltype(scalbn((bool)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbn((unsigned short)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbn((int)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbn((unsigned int)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbn((long)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbn((unsigned long)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbn((long long)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbn((unsigned long long)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbn((double)0, (int)0)), double>::value), "");
- static_assert((std::is_same<decltype(scalbn((long double)0, (int)0)), long double>::value), "");
- static_assert((std::is_same<decltype(scalbnf(0, (int)0)), float>::value), "");
- static_assert((std::is_same<decltype(scalbnl(0, (int)0)), long double>::value), "");
- static_assert((std::is_same<decltype(scalbn(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+void test_scalbn() {
+ ASSERT_SAME_TYPE(decltype(scalbn((float)0, (int)0)), float);
+ ASSERT_SAME_TYPE(decltype(scalbn((bool)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbn((unsigned short)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbn((int)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbn((unsigned int)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbn((long)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbn((unsigned long)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbn((long long)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbn((unsigned long long)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbn((double)0, (int)0)), double);
+ ASSERT_SAME_TYPE(decltype(scalbn((long double)0, (int)0)), long double);
+ ASSERT_SAME_TYPE(decltype(scalbnf(0, (int)0)), float);
+ ASSERT_SAME_TYPE(decltype(scalbnl(0, (int)0)), long double);
+ ASSERT_SAME_TYPE(decltype(scalbn(Ambiguous(), Ambiguous())), Ambiguous);
assert(scalbn(1, 1) == 2);
}
-void test_tgamma()
-{
- static_assert((std::is_same<decltype(tgammaf(0)), float>::value), "");
- static_assert((std::is_same<decltype(tgammal(0)), long double>::value), "");
- static_assert((std::is_same<decltype(tgamma(Ambiguous())), Ambiguous>::value), "");
+void test_tgamma() {
+ ASSERT_SAME_TYPE(decltype(tgammaf(0)), float);
+ ASSERT_SAME_TYPE(decltype(tgammal(0)), long double);
+ ASSERT_SAME_TYPE(decltype(tgamma(Ambiguous())), Ambiguous);
assert(tgamma(1) == 1);
}
-void test_trunc()
-{
- static_assert((std::is_same<decltype(truncf(0)), float>::value), "");
- static_assert((std::is_same<decltype(truncl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(trunc(Ambiguous())), Ambiguous>::value), "");
+void test_trunc() {
+ ASSERT_SAME_TYPE(decltype(truncf(0)), float);
+ ASSERT_SAME_TYPE(decltype(truncl(0)), long double);
+ ASSERT_SAME_TYPE(decltype(trunc(Ambiguous())), Ambiguous);
assert(trunc(1) == 1);
}
@@ -803,94 +726,94 @@ template <class PromoteResult, class Arg = void>
struct test_single_arg {
template <class T = Arg>
void operator()() {
- static_assert((std::is_same<decltype(::acos(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::acos(T())), PromoteResult);
(void)::acos(T());
- static_assert((std::is_same<decltype(::asin(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::asin(T())), PromoteResult);
(void)::asin(T());
- static_assert((std::is_same<decltype(::atan(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::atan(T())), PromoteResult);
(void)::atan(T());
- static_assert((std::is_same<decltype(::ceil(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::ceil(T())), PromoteResult);
(void)::ceil(T());
- static_assert((std::is_same<decltype(::cos(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::cos(T())), PromoteResult);
(void)::cos(T());
- static_assert((std::is_same<decltype(::cosh(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::cosh(T())), PromoteResult);
(void)::cosh(T());
- static_assert((std::is_same<decltype(::exp(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::exp(T())), PromoteResult);
(void)::exp(T());
- static_assert((std::is_same<decltype(::fabs(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::fabs(T())), PromoteResult);
(void)::fabs(T());
- static_assert((std::is_same<decltype(::floor(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::floor(T())), PromoteResult);
(void)::floor(T());
int ip;
- static_assert((std::is_same<decltype(::frexp(T(), &ip)), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::frexp(T(), &ip)), PromoteResult);
(void)::frexp(T(), &ip);
- static_assert((std::is_same<decltype(::ldexp(T(), ip)), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::ldexp(T(), ip)), PromoteResult);
(void)::ldexp(T(), ip);
- static_assert((std::is_same<decltype(::log(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::log(T())), PromoteResult);
(void)::log(T());
- static_assert((std::is_same<decltype(::log10(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::log10(T())), PromoteResult);
(void)::log10(T());
- static_assert((std::is_same<decltype(::sin(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::sin(T())), PromoteResult);
(void)::sin(T());
- static_assert((std::is_same<decltype(::sinh(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::sinh(T())), PromoteResult);
(void)::sinh(T());
- static_assert((std::is_same<decltype(::sqrt(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::sqrt(T())), PromoteResult);
(void)::sqrt(T());
- static_assert((std::is_same<decltype(::tan(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::tan(T())), PromoteResult);
(void)::tan(T());
- static_assert((std::is_same<decltype(::tanh(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::tanh(T())), PromoteResult);
(void)::tanh(T());
- static_assert((std::is_same<decltype(::signbit(T())), bool>::value), "");
+ ASSERT_SAME_TYPE(decltype(::signbit(T())), bool);
(void)::signbit(T());
- static_assert((std::is_same<decltype(::fpclassify(T())), int>::value), "");
+ ASSERT_SAME_TYPE(decltype(::fpclassify(T())), int);
(void)::fpclassify(T());
- static_assert((std::is_same<decltype(::isfinite(T())), bool>::value), "");
+ ASSERT_SAME_TYPE(decltype(::isfinite(T())), bool);
(void)::isfinite(T());
- static_assert((std::is_same<decltype(::isnormal(T())), bool>::value), "");
+ ASSERT_SAME_TYPE(decltype(::isnormal(T())), bool);
(void)::isnormal(T());
- static_assert((std::is_same<decltype(::acosh(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::acosh(T())), PromoteResult);
(void)::acosh(T());
- static_assert((std::is_same<decltype(::asinh(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::asinh(T())), PromoteResult);
(void)::asinh(T());
- static_assert((std::is_same<decltype(::atanh(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::atanh(T())), PromoteResult);
(void)::atanh(T());
- static_assert((std::is_same<decltype(::cbrt(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::cbrt(T())), PromoteResult);
(void)::cbrt(T());
- static_assert((std::is_same<decltype(::erf(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::erf(T())), PromoteResult);
(void)::erf(T());
- static_assert((std::is_same<decltype(::erfc(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::erfc(T())), PromoteResult);
(void)::erfc(T());
- static_assert((std::is_same<decltype(::exp2(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::exp2(T())), PromoteResult);
(void)::exp2(T());
- static_assert((std::is_same<decltype(::expm1(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::expm1(T())), PromoteResult);
(void)::expm1(T());
- static_assert((std::is_same<decltype(::ilogb(T())), int>::value), "");
+ ASSERT_SAME_TYPE(decltype(::ilogb(T())), int);
(void)::ilogb(T());
- static_assert((std::is_same<decltype(::lgamma(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::lgamma(T())), PromoteResult);
(void)::lgamma(T());
- static_assert((std::is_same<decltype(::llrint(T())), long long>::value), "");
+ ASSERT_SAME_TYPE(decltype(::llrint(T())), long long);
(void)::llrint(T());
- static_assert((std::is_same<decltype(::llround(T())), long long>::value), "");
+ ASSERT_SAME_TYPE(decltype(::llround(T())), long long);
(void)::llround(T());
- static_assert((std::is_same<decltype(::log1p(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::log1p(T())), PromoteResult);
(void)::log1p(T());
- static_assert((std::is_same<decltype(::log2(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::log2(T())), PromoteResult);
(void)::log2(T());
- static_assert((std::is_same<decltype(::logb(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::logb(T())), PromoteResult);
(void)::logb(T());
- static_assert((std::is_same<decltype(::lrint(T())), long>::value), "");
+ ASSERT_SAME_TYPE(decltype(::lrint(T())), long);
(void)::lrint(T());
- static_assert((std::is_same<decltype(::lround(T())), long>::value), "");
+ ASSERT_SAME_TYPE(decltype(::lround(T())), long);
(void)::lround(T());
- static_assert((std::is_same<decltype(::nearbyint(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::nearbyint(T())), PromoteResult);
(void)::nearbyint(T());
- static_assert((std::is_same<decltype(::rint(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::rint(T())), PromoteResult);
(void)::rint(T());
- static_assert((std::is_same<decltype(::round(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::round(T())), PromoteResult);
(void)::round(T());
- static_assert((std::is_same<decltype(::trunc(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::trunc(T())), PromoteResult);
(void)::trunc(T());
- static_assert((std::is_same<decltype(::tgamma(T())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::tgamma(T())), PromoteResult);
(void)::tgamma(T());
}
};
@@ -899,40 +822,40 @@ template <class PromoteResult, class Arg1 = void, class Arg2 = void>
struct test_two_args {
template <class T = Arg1, class U = Arg2>
void operator()() {
- static_assert((std::is_same<decltype(::atan2(T(), U())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::atan2(T(), U())), PromoteResult);
(void)::atan2(T(), U());
- static_assert((std::is_same<decltype(::fmod(T(), U())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::fmod(T(), U())), PromoteResult);
(void)::fmod(T(), U());
- static_assert((std::is_same<decltype(::pow(T(), U())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::pow(T(), U())), PromoteResult);
(void)::pow(T(), U());
- static_assert((std::is_same<decltype(::isgreater(T(), U())), bool>::value), "");
+ ASSERT_SAME_TYPE(decltype(::isgreater(T(), U())), bool);
(void)::isgreater(T(), U());
- static_assert((std::is_same<decltype(::isgreaterequal(T(), U())), bool>::value), "");
+ ASSERT_SAME_TYPE(decltype(::isgreaterequal(T(), U())), bool);
(void)::isgreaterequal(T(), U());
- static_assert((std::is_same<decltype(::isless(T(), U())), bool>::value), "");
+ ASSERT_SAME_TYPE(decltype(::isless(T(), U())), bool);
(void)::isless(T(), U());
- static_assert((std::is_same<decltype(::islessequal(T(), U())), bool>::value), "");
+ ASSERT_SAME_TYPE(decltype(::islessequal(T(), U())), bool);
(void)::islessequal(T(), U());
- static_assert((std::is_same<decltype(::islessgreater(T(), U())), bool>::value), "");
+ ASSERT_SAME_TYPE(decltype(::islessgreater(T(), U())), bool);
(void)::islessgreater(T(), U());
- static_assert((std::is_same<decltype(::isunordered(T(), U())), bool>::value), "");
+ ASSERT_SAME_TYPE(decltype(::isunordered(T(), U())), bool);
(void)::isunordered(T(), U());
- static_assert((std::is_same<decltype(::copysign(T(), U())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::copysign(T(), U())), PromoteResult);
(void)::copysign(T(), U());
- static_assert((std::is_same<decltype(::fdim(T(), U())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::fdim(T(), U())), PromoteResult);
(void)::fdim(T(), U());
- static_assert((std::is_same<decltype(::fmax(T(), U())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::fmax(T(), U())), PromoteResult);
(void)::fmax(T(), U());
- static_assert((std::is_same<decltype(::fmin(T(), U())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::fmin(T(), U())), PromoteResult);
(void)::fmin(T(), U());
- static_assert((std::is_same<decltype(::hypot(T(), U())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::hypot(T(), U())), PromoteResult);
(void)::hypot(T(), U());
- static_assert((std::is_same<decltype(::nextafter(T(), U())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::nextafter(T(), U())), PromoteResult);
(void)::nextafter(T(), U());
- static_assert((std::is_same<decltype(::remainder(T(), U())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::remainder(T(), U())), PromoteResult);
(void)::remainder(T(), U());
int ip;
- static_assert((std::is_same<decltype(::remquo(T(), U(), &ip)), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::remquo(T(), U(), &ip)), PromoteResult);
::remquo(T(), U(), &ip);
}
};
@@ -941,7 +864,7 @@ template <class PromoteResult, class Arg1 = void, class Arg2 = void, class Arg3
struct test_three_args {
template <class T = Arg1, class U = Arg2, class V = Arg3>
void operator()() {
- static_assert((std::is_same<decltype(::fma(T(), U(), V())), PromoteResult>::value), "");
+ ASSERT_SAME_TYPE(decltype(::fma(T(), U(), V())), PromoteResult);
(void)::fma(T(), U(), V());
}
};
@@ -974,8 +897,7 @@ struct CallThreeArgs {
}
};
-int main(int, char**)
-{
+int main(int, char**) {
types::for_each(types::integral_types(), test_single_arg</*PromoteResult=*/double>());
test_single_arg</*PromoteResult=*/float, /*Arg=*/float>();
test_single_arg</*PromoteResult=*/double, /*Arg=*/double>();
diff --git a/libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp
index c8d50be3b414f..7a49a85510202 100644
--- a/libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp
@@ -9,11 +9,12 @@
// test <setjmp.h>
#include <setjmp.h>
-#include <type_traits>
+
+#include "test_macros.h"
#ifndef setjmp
#error setjmp not defined
#endif
jmp_buf jb;
-static_assert(std::is_same<decltype(longjmp(jb, 0)), void>::value, "");
+ASSERT_SAME_TYPE(void, decltype(longjmp(jb, 0)));
diff --git a/libcxx/test/std/depr/depr.c.headers/signal_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/signal_h.compile.pass.cpp
index 9b18e768e8275..ace2eea17225a 100644
--- a/libcxx/test/std/depr/depr.c.headers/signal_h.compile.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/signal_h.compile.pass.cpp
@@ -9,7 +9,8 @@
// test <signal.h>
#include <signal.h>
-#include <type_traits>
+
+#include "test_macros.h"
#ifndef SIG_DFL
#error SIG_DFL not defined
@@ -49,5 +50,5 @@
sig_atomic_t sig;
typedef void (*func)(int);
-static_assert((std::is_same<decltype(signal(0, (func)0)), func>::value), "");
-static_assert((std::is_same<decltype(raise(0)), int>::value), "");
+ASSERT_SAME_TYPE(func, decltype(signal(0, (func)0)));
+ASSERT_SAME_TYPE(int, decltype(raise(0)));
diff --git a/libcxx/test/std/depr/depr.c.headers/stddef_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stddef_h.compile.pass.cpp
new file mode 100644
index 0000000000000..fed867f460f26
--- /dev/null
+++ b/libcxx/test/std/depr/depr.c.headers/stddef_h.compile.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <stddef.h>
+
+#include <stddef.h>
+
+#include "test_macros.h"
+
+void use() {
+ // Make sure we can use the following types without including anything else
+ (void)sizeof(size_t);
+ (void)sizeof(ptr
diff _t);
+#if TEST_STD_VER >= 11
+ (void)sizeof(nullptr);
+ (void)sizeof(nullptr_t);
+ (void)sizeof(max_align_t);
+#endif
+}
+
+#ifndef NULL
+#error NULL not defined
+#endif
+
+#ifndef offsetof
+#error offsetof not defined
+#endif
+
+#include <type_traits>
+
+static_assert(sizeof(size_t) == sizeof(void*), "");
+static_assert(std::is_unsigned<size_t>::value, "");
+static_assert(std::is_integral<size_t>::value, "");
+static_assert(sizeof(ptr
diff _t) == sizeof(void*), "");
+static_assert(std::is_signed<ptr
diff _t>::value, "");
+static_assert(std::is_integral<ptr
diff _t>::value, "");
+static_assert((std::is_same<decltype(nullptr), nullptr_t>::value), "");
+static_assert(sizeof(nullptr_t) == sizeof(void*), "");
+#if TEST_STD_VER >= 11
+# if TEST_STD_VER >= 20
+// P0767
+static_assert(std::is_trivial<max_align_t>::value, "");
+static_assert(std::is_standard_layout<max_align_t>::value, "");
+# else
+static_assert(std::is_pod<max_align_t>::value, "");
+# endif
+static_assert(std::alignment_of<max_align_t>::value >= std::alignment_of<long long>::value, "");
+static_assert(std::alignment_of<max_align_t>::value >= std::alignment_of<long double>::value, "");
+static_assert(std::alignment_of<max_align_t>::value >= std::alignment_of<void*>::value, "");
+#endif // TEST_STD_VER >= 11
diff --git a/libcxx/test/std/depr/depr.c.headers/stddef_h.nullptr.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stddef_h.nullptr.pass.cpp
new file mode 100644
index 0000000000000..52cd7e66f99f9
--- /dev/null
+++ b/libcxx/test/std/depr/depr.c.headers/stddef_h.nullptr.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <stddef.h>
+
+#include <stddef.h>
+#include <cassert>
+
+int main(int, char**) {
+ {
+ void *p = NULL;
+ assert(!p);
+ }
+ {
+ void *p = nullptr;
+ assert(!p);
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp
deleted file mode 100644
index 43db797d2f5ee..0000000000000
--- a/libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <stddef.h>
-
-#include <stddef.h>
-#include <cassert>
-#include <type_traits>
-
-#include "test_macros.h"
-
-#ifndef NULL
-#error NULL not defined
-#endif
-
-#ifndef offsetof
-#error offsetof not defined
-#endif
-
-int main(int, char**) {
- void *p = NULL;
- assert(!p);
-
- static_assert(sizeof(size_t) == sizeof(void*),
- "sizeof(size_t) == sizeof(void*)");
- static_assert(std::is_unsigned<size_t>::value,
- "std::is_unsigned<size_t>::value");
- static_assert(std::is_integral<size_t>::value,
- "std::is_integral<size_t>::value");
- static_assert(sizeof(ptr
diff _t) == sizeof(void*),
- "sizeof(ptr
diff _t) == sizeof(void*)");
- static_assert(std::is_signed<ptr
diff _t>::value,
- "std::is_signed<ptr
diff _t>::value");
- static_assert(std::is_integral<ptr
diff _t>::value,
- "std::is_integral<ptr
diff _t>::value");
- static_assert((std::is_same<decltype(nullptr), nullptr_t>::value),
- "decltype(nullptr) == nullptr_t");
- static_assert(sizeof(nullptr_t) == sizeof(void*),
- "sizeof(nullptr_t) == sizeof(void*)");
-#if TEST_STD_VER >= 11
-#if TEST_STD_VER > 17
-// P0767
- static_assert(std::is_trivial<max_align_t>::value,
- "std::is_trivial<max_align_t>::value");
- static_assert(std::is_standard_layout<max_align_t>::value,
- "std::is_standard_layout<max_align_t>::value");
-#else
- static_assert(std::is_pod<max_align_t>::value,
- "std::is_pod<max_align_t>::value");
-#endif
- static_assert((std::alignment_of<max_align_t>::value >=
- std::alignment_of<long long>::value),
- "std::alignment_of<max_align_t>::value >= "
- "std::alignment_of<long long>::value");
- static_assert(std::alignment_of<max_align_t>::value >=
- std::alignment_of<long double>::value,
- "std::alignment_of<max_align_t>::value >= "
- "std::alignment_of<long double>::value");
- static_assert(std::alignment_of<max_align_t>::value >=
- std::alignment_of<void*>::value,
- "std::alignment_of<max_align_t>::value >= "
- "std::alignment_of<void*>::value");
-#endif
-
- return 0;
-}
diff --git a/libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp
index 9a5faadbb8fd3..080efcd4fb3e3 100644
--- a/libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp
@@ -9,6 +9,45 @@
// test <stdint.h>
#include <stdint.h>
+
+void use() {
+ // Make sure we can use the following types without including anything else
+ (void)sizeof(int8_t);
+ (void)sizeof(int16_t);
+ (void)sizeof(int32_t);
+ (void)sizeof(int64_t);
+
+ (void)sizeof(uint8_t);
+ (void)sizeof(uint16_t);
+ (void)sizeof(uint32_t);
+ (void)sizeof(uint64_t);
+
+ (void)sizeof(int_least8_t);
+ (void)sizeof(int_least16_t);
+ (void)sizeof(int_least32_t);
+ (void)sizeof(int_least64_t);
+
+ (void)sizeof(uint_least8_t);
+ (void)sizeof(uint_least16_t);
+ (void)sizeof(uint_least32_t);
+ (void)sizeof(uint_least64_t);
+
+ (void)sizeof(int_fast8_t);
+ (void)sizeof(int_fast16_t);
+ (void)sizeof(int_fast32_t);
+ (void)sizeof(int_fast64_t);
+
+ (void)sizeof(uint_fast8_t);
+ (void)sizeof(uint_fast16_t);
+ (void)sizeof(uint_fast32_t);
+ (void)sizeof(uint_fast64_t);
+
+ (void)sizeof(intptr_t);
+ (void)sizeof(uintptr_t);
+ (void)sizeof(intmax_t);
+ (void)sizeof(uintmax_t);
+}
+
#include <cstddef>
#include <csignal>
#include <climits>
@@ -24,188 +63,132 @@
int main(int, char**) {
// typedef int8_t
- static_assert(sizeof(int8_t)*CHAR_BIT == 8,
- "sizeof(int8_t)*CHAR_BIT == 8");
- static_assert(std::is_signed<int8_t>::value,
- "std::is_signed<int8_t>::value");
+ static_assert(sizeof(int8_t)*CHAR_BIT == 8, "");
+ static_assert(std::is_signed<int8_t>::value, "");
// typedef int16_t
- static_assert(sizeof(int16_t)*CHAR_BIT == 16,
- "sizeof(int16_t)*CHAR_BIT == 16");
- static_assert(std::is_signed<int16_t>::value,
- "std::is_signed<int16_t>::value");
+ static_assert(sizeof(int16_t)*CHAR_BIT == 16, "");
+ static_assert(std::is_signed<int16_t>::value, "");
// typedef int32_t
- static_assert(sizeof(int32_t)*CHAR_BIT == 32,
- "sizeof(int32_t)*CHAR_BIT == 32");
- static_assert(std::is_signed<int32_t>::value,
- "std::is_signed<int32_t>::value");
+ static_assert(sizeof(int32_t)*CHAR_BIT == 32, "");
+ static_assert(std::is_signed<int32_t>::value, "");
// typedef int64_t
- static_assert(sizeof(int64_t)*CHAR_BIT == 64,
- "sizeof(int64_t)*CHAR_BIT == 64");
- static_assert(std::is_signed<int64_t>::value,
- "std::is_signed<int64_t>::value");
+ static_assert(sizeof(int64_t)*CHAR_BIT == 64, "");
+ static_assert(std::is_signed<int64_t>::value, "");
// typedef uint8_t
- static_assert(sizeof(uint8_t)*CHAR_BIT == 8,
- "sizeof(uint8_t)*CHAR_BIT == 8");
- static_assert(std::is_unsigned<uint8_t>::value,
- "std::is_unsigned<uint8_t>::value");
+ static_assert(sizeof(uint8_t)*CHAR_BIT == 8, "");
+ static_assert(std::is_unsigned<uint8_t>::value, "");
// typedef uint16_t
- static_assert(sizeof(uint16_t)*CHAR_BIT == 16,
- "sizeof(uint16_t)*CHAR_BIT == 16");
- static_assert(std::is_unsigned<uint16_t>::value,
- "std::is_unsigned<uint16_t>::value");
+ static_assert(sizeof(uint16_t)*CHAR_BIT == 16, "");
+ static_assert(std::is_unsigned<uint16_t>::value, "");
// typedef uint32_t
- static_assert(sizeof(uint32_t)*CHAR_BIT == 32,
- "sizeof(uint32_t)*CHAR_BIT == 32");
- static_assert(std::is_unsigned<uint32_t>::value,
- "std::is_unsigned<uint32_t>::value");
+ static_assert(sizeof(uint32_t)*CHAR_BIT == 32, "");
+ static_assert(std::is_unsigned<uint32_t>::value, "");
// typedef uint64_t
- static_assert(sizeof(uint64_t)*CHAR_BIT == 64,
- "sizeof(uint64_t)*CHAR_BIT == 64");
- static_assert(std::is_unsigned<uint64_t>::value,
- "std::is_unsigned<uint64_t>::value");
+ static_assert(sizeof(uint64_t)*CHAR_BIT == 64, "");
+ static_assert(std::is_unsigned<uint64_t>::value, "");
// typedef int_least8_t
- static_assert(sizeof(int_least8_t)*CHAR_BIT >= 8,
- "sizeof(int_least8_t)*CHAR_BIT >= 8");
- static_assert(std::is_signed<int_least8_t>::value,
- "std::is_signed<int_least8_t>::value");
+ static_assert(sizeof(int_least8_t)*CHAR_BIT >= 8, "");
+ static_assert(std::is_signed<int_least8_t>::value, "");
// typedef int_least16_t
- static_assert(sizeof(int_least16_t)*CHAR_BIT >= 16,
- "sizeof(int_least16_t)*CHAR_BIT >= 16");
- static_assert(std::is_signed<int_least16_t>::value,
- "std::is_signed<int_least16_t>::value");
+ static_assert(sizeof(int_least16_t)*CHAR_BIT >= 16, "");
+ static_assert(std::is_signed<int_least16_t>::value, "");
// typedef int_least32_t
- static_assert(sizeof(int_least32_t)*CHAR_BIT >= 32,
- "sizeof(int_least32_t)*CHAR_BIT >= 32");
- static_assert(std::is_signed<int_least32_t>::value,
- "std::is_signed<int_least32_t>::value");
+ static_assert(sizeof(int_least32_t)*CHAR_BIT >= 32, "");
+ static_assert(std::is_signed<int_least32_t>::value, "");
// typedef int_least64_t
- static_assert(sizeof(int_least64_t)*CHAR_BIT >= 64,
- "sizeof(int_least64_t)*CHAR_BIT >= 64");
- static_assert(std::is_signed<int_least64_t>::value,
- "std::is_signed<int_least64_t>::value");
+ static_assert(sizeof(int_least64_t)*CHAR_BIT >= 64, "");
+ static_assert(std::is_signed<int_least64_t>::value, "");
// typedef uint_least8_t
- static_assert(sizeof(uint_least8_t)*CHAR_BIT >= 8,
- "sizeof(uint_least8_t)*CHAR_BIT >= 8");
- static_assert(std::is_unsigned<uint_least8_t>::value,
- "std::is_unsigned<uint_least8_t>::value");
+ static_assert(sizeof(uint_least8_t)*CHAR_BIT >= 8, "");
+ static_assert(std::is_unsigned<uint_least8_t>::value, "");
// typedef uint_least16_t
- static_assert(sizeof(uint_least16_t)*CHAR_BIT >= 16,
- "sizeof(uint_least16_t)*CHAR_BIT >= 16");
- static_assert(std::is_unsigned<uint_least16_t>::value,
- "std::is_unsigned<uint_least16_t>::value");
+ static_assert(sizeof(uint_least16_t)*CHAR_BIT >= 16, "");
+ static_assert(std::is_unsigned<uint_least16_t>::value, "");
// typedef uint_least32_t
- static_assert(sizeof(uint_least32_t)*CHAR_BIT >= 32,
- "sizeof(uint_least32_t)*CHAR_BIT >= 32");
- static_assert(std::is_unsigned<uint_least32_t>::value,
- "std::is_unsigned<uint_least32_t>::value");
+ static_assert(sizeof(uint_least32_t)*CHAR_BIT >= 32, "");
+ static_assert(std::is_unsigned<uint_least32_t>::value, "");
// typedef uint_least64_t
- static_assert(sizeof(uint_least64_t)*CHAR_BIT >= 64,
- "sizeof(uint_least64_t)*CHAR_BIT >= 64");
- static_assert(std::is_unsigned<uint_least64_t>::value,
- "std::is_unsigned<uint_least64_t>::value");
+ static_assert(sizeof(uint_least64_t)*CHAR_BIT >= 64, "");
+ static_assert(std::is_unsigned<uint_least64_t>::value, "");
// typedef int_fast8_t
- static_assert(sizeof(int_fast8_t)*CHAR_BIT >= 8,
- "sizeof(int_fast8_t)*CHAR_BIT >= 8");
- static_assert(std::is_signed<int_fast8_t>::value,
- "std::is_signed<int_fast8_t>::value");
+ static_assert(sizeof(int_fast8_t)*CHAR_BIT >= 8, "");
+ static_assert(std::is_signed<int_fast8_t>::value, "");
// typedef int_fast16_t
- static_assert(sizeof(int_fast16_t)*CHAR_BIT >= 16,
- "sizeof(int_fast16_t)*CHAR_BIT >= 16");
- static_assert(std::is_signed<int_fast16_t>::value,
- "std::is_signed<int_fast16_t>::value");
+ static_assert(sizeof(int_fast16_t)*CHAR_BIT >= 16, "");
+ static_assert(std::is_signed<int_fast16_t>::value, "");
// typedef int_fast32_t
- static_assert(sizeof(int_fast32_t)*CHAR_BIT >= 32,
- "sizeof(int_fast32_t)*CHAR_BIT >= 32");
- static_assert(std::is_signed<int_fast32_t>::value,
- "std::is_signed<int_fast32_t>::value");
+ static_assert(sizeof(int_fast32_t)*CHAR_BIT >= 32, "");
+ static_assert(std::is_signed<int_fast32_t>::value, "");
// typedef int_fast64_t
- static_assert(sizeof(int_fast64_t)*CHAR_BIT >= 64,
- "sizeof(int_fast64_t)*CHAR_BIT >= 64");
- static_assert(std::is_signed<int_fast64_t>::value,
- "std::is_signed<int_fast64_t>::value");
+ static_assert(sizeof(int_fast64_t)*CHAR_BIT >= 64, "");
+ static_assert(std::is_signed<int_fast64_t>::value, "");
// typedef uint_fast8_t
- static_assert(sizeof(uint_fast8_t)*CHAR_BIT >= 8,
- "sizeof(uint_fast8_t)*CHAR_BIT >= 8");
- static_assert(std::is_unsigned<uint_fast8_t>::value,
- "std::is_unsigned<uint_fast8_t>::value");
+ static_assert(sizeof(uint_fast8_t)*CHAR_BIT >= 8, "");
+ static_assert(std::is_unsigned<uint_fast8_t>::value, "");
// typedef uint_fast16_t
- static_assert(sizeof(uint_fast16_t)*CHAR_BIT >= 16,
- "sizeof(uint_fast16_t)*CHAR_BIT >= 16");
- static_assert(std::is_unsigned<uint_fast16_t>::value,
- "std::is_unsigned<uint_fast16_t>::value");
+ static_assert(sizeof(uint_fast16_t)*CHAR_BIT >= 16, "");
+ static_assert(std::is_unsigned<uint_fast16_t>::value, "");
// typedef uint_fast32_t
- static_assert(sizeof(uint_fast32_t)*CHAR_BIT >= 32,
- "sizeof(uint_fast32_t)*CHAR_BIT >= 32");
- static_assert(std::is_unsigned<uint_fast32_t>::value,
- "std::is_unsigned<uint_fast32_t>::value");
+ static_assert(sizeof(uint_fast32_t)*CHAR_BIT >= 32, "");
+ static_assert(std::is_unsigned<uint_fast32_t>::value, "");
// typedef uint_fast64_t
- static_assert(sizeof(uint_fast64_t)*CHAR_BIT >= 64,
- "sizeof(uint_fast64_t)*CHAR_BIT >= 64");
- static_assert(std::is_unsigned<uint_fast64_t>::value,
- "std::is_unsigned<uint_fast64_t>::value");
+ static_assert(sizeof(uint_fast64_t)*CHAR_BIT >= 64, "");
+ static_assert(std::is_unsigned<uint_fast64_t>::value, "");
// typedef intptr_t
- static_assert(sizeof(intptr_t) >= sizeof(void*),
- "sizeof(intptr_t) >= sizeof(void*)");
- static_assert(std::is_signed<intptr_t>::value,
- "std::is_signed<intptr_t>::value");
+ static_assert(sizeof(intptr_t) >= sizeof(void*), "");
+ static_assert(std::is_signed<intptr_t>::value, "");
// typedef uintptr_t
- static_assert(sizeof(uintptr_t) >= sizeof(void*),
- "sizeof(uintptr_t) >= sizeof(void*)");
- static_assert(std::is_unsigned<uintptr_t>::value,
- "std::is_unsigned<uintptr_t>::value");
+ static_assert(sizeof(uintptr_t) >= sizeof(void*), "");
+ static_assert(std::is_unsigned<uintptr_t>::value, "");
// typedef intmax_t
- static_assert(sizeof(intmax_t) >= sizeof(long long),
- "sizeof(intmax_t) >= sizeof(long long)");
- static_assert(std::is_signed<intmax_t>::value,
- "std::is_signed<intmax_t>::value");
+ static_assert(sizeof(intmax_t) >= sizeof(long long), "");
+ static_assert(std::is_signed<intmax_t>::value, "");
// typedef uintmax_t
- static_assert(sizeof(uintmax_t) >= sizeof(unsigned long long),
- "sizeof(uintmax_t) >= sizeof(unsigned long long)");
- static_assert(std::is_unsigned<uintmax_t>::value,
- "std::is_unsigned<uintmax_t>::value");
+ static_assert(sizeof(uintmax_t) >= sizeof(unsigned long long), "");
+ static_assert(std::is_unsigned<uintmax_t>::value, "");
// INTN_MIN
- static_assert(INT8_MIN == -128, "INT8_MIN == -128");
- static_assert(INT16_MIN == -32768, "INT16_MIN == -32768");
- static_assert(INT32_MIN == -2147483647 - 1, "INT32_MIN == -2147483648");
- static_assert(INT64_MIN == -9223372036854775807LL - 1, "INT64_MIN == -9223372036854775808LL");
+ static_assert(INT8_MIN == -128, "");
+ static_assert(INT16_MIN == -32768, "");
+ static_assert(INT32_MIN == -2147483647 - 1, "");
+ static_assert(INT64_MIN == -9223372036854775807LL - 1, "");
// INTN_MAX
- static_assert(INT8_MAX == 127, "INT8_MAX == 127");
- static_assert(INT16_MAX == 32767, "INT16_MAX == 32767");
- static_assert(INT32_MAX == 2147483647, "INT32_MAX == 2147483647");
- static_assert(INT64_MAX == 9223372036854775807LL, "INT64_MAX == 9223372036854775807LL");
+ static_assert(INT8_MAX == 127, "");
+ static_assert(INT16_MAX == 32767, "");
+ static_assert(INT32_MAX == 2147483647, "");
+ static_assert(INT64_MAX == 9223372036854775807LL, "");
// UINTN_MAX
- static_assert(UINT8_MAX == 255, "UINT8_MAX == 255");
- static_assert(UINT16_MAX == 65535, "UINT16_MAX == 65535");
- static_assert(UINT32_MAX == 4294967295U, "UINT32_MAX == 4294967295");
- static_assert(UINT64_MAX == 18446744073709551615ULL, "UINT64_MAX == 18446744073709551615ULL");
+ static_assert(UINT8_MAX == 255, "");
+ static_assert(UINT16_MAX == 65535, "");
+ static_assert(UINT32_MAX == 4294967295U, "");
+ static_assert(UINT64_MAX == 18446744073709551615ULL, "");
// INT_FASTN_MIN
- static_assert(INT_FAST8_MIN <= -128, "INT_FAST8_MIN <= -128");
- static_assert(INT_FAST16_MIN <= -32768, "INT_FAST16_MIN <= -32768");
- static_assert(INT_FAST32_MIN <= -2147483647 - 1, "INT_FAST32_MIN <= -2147483648");
- static_assert(INT_FAST64_MIN <= -9223372036854775807LL - 1, "INT_FAST64_MIN <= -9223372036854775808LL");
+ static_assert(INT_FAST8_MIN <= -128, "");
+ static_assert(INT_FAST16_MIN <= -32768, "");
+ static_assert(INT_FAST32_MIN <= -2147483647 - 1, "");
+ static_assert(INT_FAST64_MIN <= -9223372036854775807LL - 1, "");
// INT_FASTN_MAX
- static_assert(INT_FAST8_MAX >= 127, "INT_FAST8_MAX >= 127");
- static_assert(INT_FAST16_MAX >= 32767, "INT_FAST16_MAX >= 32767");
- static_assert(INT_FAST32_MAX >= 2147483647, "INT_FAST32_MAX >= 2147483647");
- static_assert(INT_FAST64_MAX >= 9223372036854775807LL, "INT_FAST64_MAX >= 9223372036854775807LL");
+ static_assert(INT_FAST8_MAX >= 127, "");
+ static_assert(INT_FAST16_MAX >= 32767, "");
+ static_assert(INT_FAST32_MAX >= 2147483647, "");
+ static_assert(INT_FAST64_MAX >= 9223372036854775807LL, "");
// UINT_FASTN_MAX
- static_assert(UINT_FAST8_MAX >= 255, "UINT_FAST8_MAX >= 255");
- static_assert(UINT_FAST16_MAX >= 65535, "UINT_FAST16_MAX >= 65535");
- static_assert(UINT_FAST32_MAX >= 4294967295U, "UINT_FAST32_MAX >= 4294967295");
- static_assert(UINT_FAST64_MAX >= 18446744073709551615ULL, "UINT_FAST64_MAX >= 18446744073709551615ULL");
+ static_assert(UINT_FAST8_MAX >= 255, "");
+ static_assert(UINT_FAST16_MAX >= 65535, "");
+ static_assert(UINT_FAST32_MAX >= 4294967295U, "");
+ static_assert(UINT_FAST64_MAX >= 18446744073709551615ULL, "");
// INTPTR_MIN
assert(INTPTR_MIN == std::numeric_limits<intptr_t>::min());
diff --git a/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp
new file mode 100644
index 0000000000000..27a97627cee38
--- /dev/null
+++ b/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp
@@ -0,0 +1,176 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// test <stdio.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "test_macros.h"
+
+#ifdef getc
+#error getc is defined
+#endif
+
+#ifdef putc
+#error putc is defined
+#endif
+
+#ifdef clearerr
+#error clearerr is defined
+#endif
+
+#ifdef feof
+#error feof is defined
+#endif
+
+#ifdef ferror
+#error ferror is defined
+#endif
+
+#ifndef BUFSIZ
+#error BUFSIZ not defined
+#endif
+
+#ifndef EOF
+#error EOF not defined
+#endif
+
+#ifndef FILENAME_MAX
+#error FILENAME_MAX not defined
+#endif
+
+#ifndef FOPEN_MAX
+#error FOPEN_MAX not defined
+#endif
+
+#ifndef L_tmpnam
+#error L_tmpnam not defined
+#endif
+
+#ifndef NULL
+#error NULL not defined
+#endif
+
+#ifndef SEEK_CUR
+#error SEEK_CUR not defined
+#endif
+
+#ifndef SEEK_END
+#error SEEK_END not defined
+#endif
+
+#ifndef SEEK_SET
+#error SEEK_SET not defined
+#endif
+
+#ifndef TMP_MAX
+#error TMP_MAX not defined
+#endif
+
+#ifndef _IOFBF
+#error _IOFBF not defined
+#endif
+
+#ifndef _IOLBF
+#error _IOLBF not defined
+#endif
+
+#ifndef _IONBF
+#error _IONBF not defined
+#endif
+
+#ifndef stderr
+#error stderr not defined
+#endif
+
+#ifndef stdin
+#error stdin not defined
+#endif
+
+#ifndef stdout
+#error stdout not defined
+#endif
+
+TEST_CLANG_DIAGNOSTIC_IGNORED("-Wformat-zero-length")
+TEST_GCC_DIAGNOSTIC_IGNORED("-Wformat-zero-length")
+
+FILE* fp = 0;
+fpos_t fpos = fpos_t();
+size_t s = 0;
+char* cp = 0;
+char arr[] = {'a', 'b'};
+va_list va;
+ASSERT_SAME_TYPE(int, decltype(remove("")));
+ASSERT_SAME_TYPE(int, decltype(rename("","")));
+ASSERT_SAME_TYPE(FILE*, decltype(tmpfile()));
+TEST_DIAGNOSTIC_PUSH
+TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+ASSERT_SAME_TYPE(char*, decltype(tmpnam(cp)));
+TEST_DIAGNOSTIC_POP
+ASSERT_SAME_TYPE(int, decltype(fclose(fp)));
+ASSERT_SAME_TYPE(int, decltype(fflush(fp)));
+ASSERT_SAME_TYPE(FILE*, decltype(fopen("", "")));
+ASSERT_SAME_TYPE(FILE*, decltype(freopen("", "", fp)));
+ASSERT_SAME_TYPE(void, decltype(setbuf(fp,cp)));
+ASSERT_SAME_TYPE(int, decltype(vfprintf(fp,"",va)));
+ASSERT_SAME_TYPE(int, decltype(fprintf(fp," ")));
+ASSERT_SAME_TYPE(int, decltype(fscanf(fp,"")));
+ASSERT_SAME_TYPE(int, decltype(printf("\n")));
+ASSERT_SAME_TYPE(int, decltype(scanf("\n")));
+ASSERT_SAME_TYPE(int, decltype(snprintf(cp,0,"p")));
+TEST_DIAGNOSTIC_PUSH
+TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+ASSERT_SAME_TYPE(int, decltype(sprintf(cp," ")));
+TEST_DIAGNOSTIC_POP
+ASSERT_SAME_TYPE(int, decltype(sscanf("","")));
+ASSERT_SAME_TYPE(int, decltype(vfprintf(fp,"",va)));
+ASSERT_SAME_TYPE(int, decltype(vfscanf(fp,"",va)));
+ASSERT_SAME_TYPE(int, decltype(vprintf(" ",va)));
+ASSERT_SAME_TYPE(int, decltype(vscanf("",va)));
+ASSERT_SAME_TYPE(int, decltype(vsnprintf(cp,0," ",va)));
+TEST_DIAGNOSTIC_PUSH
+TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+ASSERT_SAME_TYPE(int, decltype(vsprintf(cp," ",va)));
+TEST_DIAGNOSTIC_POP
+ASSERT_SAME_TYPE(int, decltype(vsscanf("","",va)));
+ASSERT_SAME_TYPE(int, decltype(fgetc(fp)));
+ASSERT_SAME_TYPE(char*, decltype(fgets(cp,0,fp)));
+ASSERT_SAME_TYPE(int, decltype(fputc(0,fp)));
+ASSERT_SAME_TYPE(int, decltype(fputs("",fp)));
+ASSERT_SAME_TYPE(int, decltype(getc(fp)));
+ASSERT_SAME_TYPE(int, decltype(getchar()));
+#if TEST_STD_VER < 14
+TEST_DIAGNOSTIC_PUSH
+TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+ASSERT_SAME_TYPE(char*, decltype(gets(cp)));
+TEST_DIAGNOSTIC_POP
+#endif
+ASSERT_SAME_TYPE(int, decltype(putc(0,fp)));
+ASSERT_SAME_TYPE(int, decltype(putchar(0)));
+ASSERT_SAME_TYPE(int, decltype(puts("")));
+ASSERT_SAME_TYPE(int, decltype(ungetc(0,fp)));
+ASSERT_SAME_TYPE(size_t, decltype(fread((void*)0,0,0,fp)));
+ASSERT_SAME_TYPE(size_t, decltype(fwrite((const void*)arr,1,0,fp)));
+#ifndef TEST_HAS_NO_FGETPOS_FSETPOS
+ASSERT_SAME_TYPE(int, decltype(fgetpos(fp, &fpos)));
+#endif
+ASSERT_SAME_TYPE(int, decltype(fseek(fp, 0,0)));
+#ifndef TEST_HAS_NO_FGETPOS_FSETPOS
+ASSERT_SAME_TYPE(int, decltype(fsetpos(fp, &fpos)));
+#endif
+ASSERT_SAME_TYPE(long, decltype(ftell(fp)));
+ASSERT_SAME_TYPE(void, decltype(rewind(fp)));
+ASSERT_SAME_TYPE(void, decltype(clearerr(fp)));
+ASSERT_SAME_TYPE(int, decltype(feof(fp)));
+ASSERT_SAME_TYPE(int, decltype(ferror(fp)));
+ASSERT_SAME_TYPE(void, decltype(perror("")));
diff --git a/libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp
deleted file mode 100644
index 293b0944a9928..0000000000000
--- a/libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// test <stdio.h>
-
-#include <stdio.h>
-#include <type_traits>
-#include "test_macros.h"
-
-#ifdef getc
-#error getc is defined
-#endif
-
-#ifdef putc
-#error putc is defined
-#endif
-
-#ifdef clearerr
-#error clearerr is defined
-#endif
-
-#ifdef feof
-#error feof is defined
-#endif
-
-#ifdef ferror
-#error ferror is defined
-#endif
-
-#ifndef BUFSIZ
-#error BUFSIZ not defined
-#endif
-
-#ifndef EOF
-#error EOF not defined
-#endif
-
-#ifndef FILENAME_MAX
-#error FILENAME_MAX not defined
-#endif
-
-#ifndef FOPEN_MAX
-#error FOPEN_MAX not defined
-#endif
-
-#ifndef L_tmpnam
-#error L_tmpnam not defined
-#endif
-
-#ifndef NULL
-#error NULL not defined
-#endif
-
-#ifndef SEEK_CUR
-#error SEEK_CUR not defined
-#endif
-
-#ifndef SEEK_END
-#error SEEK_END not defined
-#endif
-
-#ifndef SEEK_SET
-#error SEEK_SET not defined
-#endif
-
-#ifndef TMP_MAX
-#error TMP_MAX not defined
-#endif
-
-#ifndef _IOFBF
-#error _IOFBF not defined
-#endif
-
-#ifndef _IOLBF
-#error _IOLBF not defined
-#endif
-
-#ifndef _IONBF
-#error _IONBF not defined
-#endif
-
-#ifndef stderr
-#error stderr not defined
-#endif
-
-#ifndef stdin
-#error stdin not defined
-#endif
-
-#ifndef stdout
-#error stdout not defined
-#endif
-
-#include <cstdarg>
-
-TEST_CLANG_DIAGNOSTIC_IGNORED("-Wformat-zero-length")
-TEST_GCC_DIAGNOSTIC_IGNORED("-Wformat-zero-length")
-
-int main(int, char**) {
- FILE* fp = 0;
- fpos_t fpos = fpos_t();
- size_t s = 0;
- char* cp = 0;
- char arr[] = {'a', 'b'};
- va_list va;
- ((void)fp); // Prevent unused warning
- ((void)fpos); // Prevent unused warning
- ((void)s); // Prevent unused warning
- ((void)cp); // Prevent unused warning
- ((void)arr); // Prevent unused warning
- ((void)va); // Prevent unused warning
- static_assert((std::is_same<decltype(remove("")), int>::value), "");
- static_assert((std::is_same<decltype(rename("","")), int>::value), "");
- static_assert((std::is_same<decltype(tmpfile()), FILE*>::value), "");
- TEST_DIAGNOSTIC_PUSH
- TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
- TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
- static_assert((std::is_same<decltype(tmpnam(cp)), char*>::value), "");
- TEST_DIAGNOSTIC_POP
- static_assert((std::is_same<decltype(fclose(fp)), int>::value), "");
- static_assert((std::is_same<decltype(fflush(fp)), int>::value), "");
- static_assert((std::is_same<decltype(fopen("", "")), FILE*>::value), "");
- static_assert((std::is_same<decltype(freopen("", "", fp)), FILE*>::value), "");
- static_assert((std::is_same<decltype(setbuf(fp,cp)), void>::value), "");
- static_assert((std::is_same<decltype(vfprintf(fp,"",va)), int>::value), "");
- static_assert((std::is_same<decltype(fprintf(fp," ")), int>::value), "");
- static_assert((std::is_same<decltype(fscanf(fp,"")), int>::value), "");
- static_assert((std::is_same<decltype(printf("\n")), int>::value), "");
- static_assert((std::is_same<decltype(scanf("\n")), int>::value), "");
- static_assert((std::is_same<decltype(snprintf(cp,0,"p")), int>::value), "");
- TEST_DIAGNOSTIC_PUSH
- TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
- TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
- static_assert((std::is_same<decltype(sprintf(cp," ")), int>::value), "");
- TEST_DIAGNOSTIC_POP
- static_assert((std::is_same<decltype(sscanf("","")), int>::value), "");
- static_assert((std::is_same<decltype(vfprintf(fp,"",va)), int>::value), "");
- static_assert((std::is_same<decltype(vfscanf(fp,"",va)), int>::value), "");
- static_assert((std::is_same<decltype(vprintf(" ",va)), int>::value), "");
- static_assert((std::is_same<decltype(vscanf("",va)), int>::value), "");
- static_assert((std::is_same<decltype(vsnprintf(cp,0," ",va)), int>::value), "");
- TEST_DIAGNOSTIC_PUSH
- TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
- TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
- static_assert((std::is_same<decltype(vsprintf(cp," ",va)), int>::value), "");
- TEST_DIAGNOSTIC_POP
- static_assert((std::is_same<decltype(vsscanf("","",va)), int>::value), "");
- static_assert((std::is_same<decltype(fgetc(fp)), int>::value), "");
- static_assert((std::is_same<decltype(fgets(cp,0,fp)), char*>::value), "");
- static_assert((std::is_same<decltype(fputc(0,fp)), int>::value), "");
- static_assert((std::is_same<decltype(fputs("",fp)), int>::value), "");
- static_assert((std::is_same<decltype(getc(fp)), int>::value), "");
- static_assert((std::is_same<decltype(getchar()), int>::value), "");
-#if TEST_STD_VER < 14
- TEST_DIAGNOSTIC_PUSH
- TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
- TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
- static_assert((std::is_same<decltype(gets(cp)), char*>::value), "");
- TEST_DIAGNOSTIC_POP
-#endif
- static_assert((std::is_same<decltype(putc(0,fp)), int>::value), "");
- static_assert((std::is_same<decltype(putchar(0)), int>::value), "");
- static_assert((std::is_same<decltype(puts("")), int>::value), "");
- static_assert((std::is_same<decltype(ungetc(0,fp)), int>::value), "");
- static_assert((std::is_same<decltype(fread((void*)0,0,0,fp)), size_t>::value), "");
- static_assert((std::is_same<decltype(fwrite((const void*)arr,1,0,fp)), size_t>::value), "");
-#ifndef TEST_HAS_NO_FGETPOS_FSETPOS
- static_assert((std::is_same<decltype(fgetpos(fp, &fpos)), int>::value), "");
-#endif
- static_assert((std::is_same<decltype(fseek(fp, 0,0)), int>::value), "");
-#ifndef TEST_HAS_NO_FGETPOS_FSETPOS
- static_assert((std::is_same<decltype(fsetpos(fp, &fpos)), int>::value), "");
-#endif
- static_assert((std::is_same<decltype(ftell(fp)), long>::value), "");
- static_assert((std::is_same<decltype(rewind(fp)), void>::value), "");
- static_assert((std::is_same<decltype(clearerr(fp)), void>::value), "");
- static_assert((std::is_same<decltype(feof(fp)), int>::value), "");
- static_assert((std::is_same<decltype(ferror(fp)), int>::value), "");
- static_assert((std::is_same<decltype(perror("")), void>::value), "");
-
- return 0;
-}
diff --git a/libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
index 3fd615d9c7708..ee70ed0c34b94 100644
--- a/libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
@@ -69,26 +69,18 @@ struct has_abs : decltype(has_abs_imp<T>(0)) {};
void test_abs() {
TEST_DIAGNOSTIC_PUSH
TEST_CLANG_DIAGNOSTIC_IGNORED("-Wabsolute-value")
- static_assert((std::is_same<decltype(abs((float)0)), float>::value), "");
- static_assert((std::is_same<decltype(abs((double)0)), double>::value), "");
- static_assert(
- (std::is_same<decltype(abs((long double)0)), long double>::value), "");
- static_assert((std::is_same<decltype(abs((int)0)), int>::value), "");
- static_assert((std::is_same<decltype(abs((long)0)), long>::value), "");
- static_assert((std::is_same<decltype(abs((long long)0)), long long>::value),
- "");
- static_assert((std::is_same<decltype(abs((unsigned char)0)), int>::value),
- "");
- static_assert((std::is_same<decltype(abs((unsigned short)0)), int>::value),
- "");
- static_assert((std::is_same<decltype(abs((signed char)0)), int>::value),
- "");
- static_assert((std::is_same<decltype(abs((short)0)), int>::value),
- "");
- static_assert((std::is_same<decltype(abs((unsigned char)0)), int>::value),
- "");
- static_assert((std::is_same<decltype(abs((char)0)), int>::value),
- "");
+ ASSERT_SAME_TYPE(float, decltype(abs((float)0)));
+ ASSERT_SAME_TYPE(double, decltype(abs((double)0)));
+ ASSERT_SAME_TYPE(long double, decltype(abs((long double)0)));
+ ASSERT_SAME_TYPE(int, decltype(abs((int)0)));
+ ASSERT_SAME_TYPE(long, decltype(abs((long)0)));
+ ASSERT_SAME_TYPE(long long, decltype(abs((long long)0)));
+ ASSERT_SAME_TYPE(int, decltype(abs((unsigned char)0)));
+ ASSERT_SAME_TYPE(int, decltype(abs((unsigned short)0)));
+ ASSERT_SAME_TYPE(int, decltype(abs((signed char)0)));
+ ASSERT_SAME_TYPE(int, decltype(abs((short)0)));
+ ASSERT_SAME_TYPE(int, decltype(abs((unsigned char)0)));
+ ASSERT_SAME_TYPE(int, decltype(abs((char)0)));
static_assert(!has_abs<unsigned>::value, "");
static_assert(!has_abs<unsigned long>::value, "");
@@ -106,53 +98,53 @@ int main(int, char**) {
ldiv_t ld; ((void)ld);
lldiv_t lld; ((void)lld);
char** endptr = 0;
- static_assert((std::is_same<decltype(atof("")), double>::value), "");
- static_assert((std::is_same<decltype(atoi("")), int>::value), "");
- static_assert((std::is_same<decltype(atol("")), long>::value), "");
- static_assert((std::is_same<decltype(atoll("")), long long>::value), "");
- static_assert((std::is_same<decltype(getenv("")), char*>::value), "");
- static_assert((std::is_same<decltype(strtod("", endptr)), double>::value), "");
- static_assert((std::is_same<decltype(strtof("", endptr)), float>::value), "");
- static_assert((std::is_same<decltype(strtold("", endptr)), long double>::value), "");
- static_assert((std::is_same<decltype(strtol("", endptr,0)), long>::value), "");
- static_assert((std::is_same<decltype(strtoll("", endptr,0)), long long>::value), "");
- static_assert((std::is_same<decltype(strtoul("", endptr,0)), unsigned long>::value), "");
- static_assert((std::is_same<decltype(strtoull("", endptr,0)), unsigned long long>::value), "");
- static_assert((std::is_same<decltype(rand()), int>::value), "");
- static_assert((std::is_same<decltype(srand(0)), void>::value), "");
+ ASSERT_SAME_TYPE(double, decltype(atof("")));
+ ASSERT_SAME_TYPE(int, decltype(atoi("")));
+ ASSERT_SAME_TYPE(long, decltype(atol("")));
+ ASSERT_SAME_TYPE(long long, decltype(atoll("")));
+ ASSERT_SAME_TYPE(char*, decltype(getenv("")));
+ ASSERT_SAME_TYPE(double, decltype(strtod("", endptr)));
+ ASSERT_SAME_TYPE(float, decltype(strtof("", endptr)));
+ ASSERT_SAME_TYPE(long double, decltype(strtold("", endptr)));
+ ASSERT_SAME_TYPE(long, decltype(strtol("", endptr,0)));
+ ASSERT_SAME_TYPE(long long, decltype(strtoll("", endptr,0)));
+ ASSERT_SAME_TYPE(unsigned long, decltype(strtoul("", endptr,0)));
+ ASSERT_SAME_TYPE(unsigned long long, decltype(strtoull("", endptr,0)));
+ ASSERT_SAME_TYPE(int, decltype(rand()));
+ ASSERT_SAME_TYPE(void, decltype(srand(0)));
// aligned_alloc tested in stdlib_h.aligned_alloc.compile.pass.cpp
void* pv = 0;
void (*handler)() = 0;
int (*comp)(void const*, void const*) = 0;
- static_assert((std::is_same<decltype(calloc(0,0)), void*>::value), "");
- static_assert((std::is_same<decltype(free(0)), void>::value), "");
- static_assert((std::is_same<decltype(malloc(0)), void*>::value), "");
- static_assert((std::is_same<decltype(realloc(0,0)), void*>::value), "");
- static_assert((std::is_same<decltype(abort()), void>::value), "");
- static_assert((std::is_same<decltype(atexit(handler)), int>::value), "");
- static_assert((std::is_same<decltype(exit(0)), void>::value), "");
- static_assert((std::is_same<decltype(_Exit(0)), void>::value), "");
- static_assert((std::is_same<decltype(getenv("")), char*>::value), "");
- static_assert((std::is_same<decltype(system("")), int>::value), "");
- static_assert((std::is_same<decltype(bsearch(pv,pv,0,0,comp)), void*>::value), "");
- static_assert((std::is_same<decltype(qsort(pv,0,0,comp)), void>::value), "");
- static_assert((std::is_same<decltype(abs(0)), int>::value), "");
- static_assert((std::is_same<decltype(labs((long)0)), long>::value), "");
- static_assert((std::is_same<decltype(llabs((long long)0)), long long>::value), "");
- static_assert((std::is_same<decltype(div(0,0)), div_t>::value), "");
- static_assert((std::is_same<decltype(ldiv(0L,0L)), ldiv_t>::value), "");
- static_assert((std::is_same<decltype(lldiv(0LL,0LL)), lldiv_t>::value), "");
+ ASSERT_SAME_TYPE(void*, decltype(calloc(0,0)));
+ ASSERT_SAME_TYPE(void, decltype(free(0)));
+ ASSERT_SAME_TYPE(void*, decltype(malloc(0)));
+ ASSERT_SAME_TYPE(void*, decltype(realloc(0,0)));
+ ASSERT_SAME_TYPE(void, decltype(abort()));
+ ASSERT_SAME_TYPE(int, decltype(atexit(handler)));
+ ASSERT_SAME_TYPE(void, decltype(exit(0)));
+ ASSERT_SAME_TYPE(void, decltype(_Exit(0)));
+ ASSERT_SAME_TYPE(char*, decltype(getenv("")));
+ ASSERT_SAME_TYPE(int, decltype(system("")));
+ ASSERT_SAME_TYPE(void*, decltype(bsearch(pv,pv,0,0,comp)));
+ ASSERT_SAME_TYPE(void, decltype(qsort(pv,0,0,comp)));
+ ASSERT_SAME_TYPE(int, decltype(abs(0)));
+ ASSERT_SAME_TYPE(long, decltype(labs((long)0)));
+ ASSERT_SAME_TYPE(long long, decltype(llabs((long long)0)));
+ ASSERT_SAME_TYPE(div_t, decltype(div(0,0)));
+ ASSERT_SAME_TYPE(ldiv_t, decltype(ldiv(0L,0L)));
+ ASSERT_SAME_TYPE(lldiv_t, decltype(lldiv(0LL,0LL)));
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
wchar_t* pw = 0;
const wchar_t* pwc = 0;
char* pc = 0;
- static_assert((std::is_same<decltype(mblen("",0)), int>::value), "");
- static_assert((std::is_same<decltype(mbtowc(pw,"",0)), int>::value), "");
- static_assert((std::is_same<decltype(wctomb(pc,L' ')), int>::value), "");
- static_assert((std::is_same<decltype(mbstowcs(pw,"",0)), size_t>::value), "");
- static_assert((std::is_same<decltype(wcstombs(pc,pwc,0)), size_t>::value), "");
+ ASSERT_SAME_TYPE(int, decltype(mblen("",0)));
+ ASSERT_SAME_TYPE(int, decltype(mbtowc(pw,"",0)));
+ ASSERT_SAME_TYPE(int, decltype(wctomb(pc,L' ')));
+ ASSERT_SAME_TYPE(size_t, decltype(mbstowcs(pw,"",0)));
+ ASSERT_SAME_TYPE(size_t, decltype(wcstombs(pc,pwc,0)));
#endif
test_abs();
diff --git a/libcxx/test/std/depr/depr.c.headers/string_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/string_h.pass.cpp
index 068aa1915e4fc..697b818db7884 100644
--- a/libcxx/test/std/depr/depr.c.headers/string_h.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/string_h.pass.cpp
@@ -10,7 +10,6 @@
#include <string.h>
#include <cassert>
-#include <type_traits>
#include "test_macros.h"
diff --git a/libcxx/test/std/depr/depr.c.headers/time_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/time_h.compile.pass.cpp
index 724991106770d..b7eb77bfb74b1 100644
--- a/libcxx/test/std/depr/depr.c.headers/time_h.compile.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/time_h.compile.pass.cpp
@@ -9,7 +9,8 @@
// test <time.h>
#include <time.h>
-#include <type_traits>
+
+#include "test_macros.h"
#ifndef NULL
#error NULL not defined
@@ -23,14 +24,14 @@ clock_t c = 0;
size_t s = 0;
time_t t = 0;
tm tmv = {};
-static_assert((std::is_same<decltype(clock()), clock_t>::value), "");
-static_assert((std::is_same<decltype(
diff time(t,t)), double>::value), "");
-static_assert((std::is_same<decltype(mktime(&tmv)), time_t>::value), "");
-static_assert((std::is_same<decltype(time(&t)), time_t>::value), "");
-static_assert((std::is_same<decltype(asctime(&tmv)), char*>::value), "");
-static_assert((std::is_same<decltype(ctime(&t)), char*>::value), "");
-static_assert((std::is_same<decltype(gmtime(&t)), tm*>::value), "");
-static_assert((std::is_same<decltype(localtime(&t)), tm*>::value), "");
char* c1 = 0;
const char* c2 = 0;
-static_assert((std::is_same<decltype(strftime(c1,s,c2,&tmv)), size_t>::value), "");
+ASSERT_SAME_TYPE(clock_t, decltype(clock()));
+ASSERT_SAME_TYPE(double, decltype(
diff time(t, t)));
+ASSERT_SAME_TYPE(time_t, decltype(mktime(&tmv)));
+ASSERT_SAME_TYPE(time_t, decltype(time(&t)));
+ASSERT_SAME_TYPE(char*, decltype(asctime(&tmv)));
+ASSERT_SAME_TYPE(char*, decltype(ctime(&t)));
+ASSERT_SAME_TYPE(tm*, decltype(gmtime(&t)));
+ASSERT_SAME_TYPE(tm*, decltype(localtime(&t)));
+ASSERT_SAME_TYPE(size_t, decltype(strftime(c1, s, c2, &tmv)));
diff --git a/libcxx/test/std/depr/depr.c.headers/wctype_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/wctype_h.compile.pass.cpp
index d9a175cc26281..094f7713bb365 100644
--- a/libcxx/test/std/depr/depr.c.headers/wctype_h.compile.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/wctype_h.compile.pass.cpp
@@ -11,7 +11,6 @@
// <wctype.h>
#include <wctype.h>
-#include <type_traits>
#include "test_macros.h"
@@ -94,21 +93,21 @@
wint_t w = 0;
wctrans_t wctr = 0;
wctype_t wct = 0;
-static_assert((std::is_same<decltype(iswalnum(w)), int>::value), "");
-static_assert((std::is_same<decltype(iswalpha(w)), int>::value), "");
-static_assert((std::is_same<decltype(iswblank(w)), int>::value), "");
-static_assert((std::is_same<decltype(iswcntrl(w)), int>::value), "");
-static_assert((std::is_same<decltype(iswdigit(w)), int>::value), "");
-static_assert((std::is_same<decltype(iswgraph(w)), int>::value), "");
-static_assert((std::is_same<decltype(iswlower(w)), int>::value), "");
-static_assert((std::is_same<decltype(iswprint(w)), int>::value), "");
-static_assert((std::is_same<decltype(iswpunct(w)), int>::value), "");
-static_assert((std::is_same<decltype(iswspace(w)), int>::value), "");
-static_assert((std::is_same<decltype(iswupper(w)), int>::value), "");
-static_assert((std::is_same<decltype(iswxdigit(w)), int>::value), "");
-static_assert((std::is_same<decltype(iswctype(w, wct)), int>::value), "");
-static_assert((std::is_same<decltype(wctype("")), wctype_t>::value), "");
-static_assert((std::is_same<decltype(towlower(w)), wint_t>::value), "");
-static_assert((std::is_same<decltype(towupper(w)), wint_t>::value), "");
-static_assert((std::is_same<decltype(towctrans(w, wctr)), wint_t>::value), "");
-static_assert((std::is_same<decltype(wctrans("")), wctrans_t>::value), "");
+ASSERT_SAME_TYPE(int, decltype(iswalnum(w)));
+ASSERT_SAME_TYPE(int, decltype(iswalpha(w)));
+ASSERT_SAME_TYPE(int, decltype(iswblank(w)));
+ASSERT_SAME_TYPE(int, decltype(iswcntrl(w)));
+ASSERT_SAME_TYPE(int, decltype(iswdigit(w)));
+ASSERT_SAME_TYPE(int, decltype(iswgraph(w)));
+ASSERT_SAME_TYPE(int, decltype(iswlower(w)));
+ASSERT_SAME_TYPE(int, decltype(iswprint(w)));
+ASSERT_SAME_TYPE(int, decltype(iswpunct(w)));
+ASSERT_SAME_TYPE(int, decltype(iswspace(w)));
+ASSERT_SAME_TYPE(int, decltype(iswupper(w)));
+ASSERT_SAME_TYPE(int, decltype(iswxdigit(w)));
+ASSERT_SAME_TYPE(int, decltype(iswctype(w, wct)));
+ASSERT_SAME_TYPE(wctype_t, decltype(wctype("")));
+ASSERT_SAME_TYPE(wint_t, decltype(towlower(w)));
+ASSERT_SAME_TYPE(wint_t, decltype(towupper(w)));
+ASSERT_SAME_TYPE(wint_t, decltype(towctrans(w, wctr)));
+ASSERT_SAME_TYPE(wctrans_t, decltype(wctrans("")));
More information about the libcxx-commits
mailing list