summaryrefslogtreecommitdiff
path: root/test/std/language.support/support.runtime/cstdlib.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/language.support/support.runtime/cstdlib.pass.cpp')
-rw-r--r--test/std/language.support/support.runtime/cstdlib.pass.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/test/std/language.support/support.runtime/cstdlib.pass.cpp b/test/std/language.support/support.runtime/cstdlib.pass.cpp
index 073949122b01..d8f88cf58d9d 100644
--- a/test/std/language.support/support.runtime/cstdlib.pass.cpp
+++ b/test/std/language.support/support.runtime/cstdlib.pass.cpp
@@ -11,6 +11,13 @@
#include <cstdlib>
#include <type_traits>
+#include <cassert>
+
+// As of 1/10/2015 clang emits a -Wnonnull warnings even if the warning occurs
+// in an unevaluated context. For this reason we manually suppress the warning.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wnonnull"
+#endif
#ifndef EXIT_FAILURE
#error EXIT_FAILURE not defined
@@ -32,12 +39,23 @@
#error RAND_MAX not defined
#endif
+template <class TestType, class IntType>
+void test_div_struct() {
+ TestType obj;
+ static_assert(sizeof(obj) >= sizeof(IntType) * 2, ""); // >= to account for alignment.
+ static_assert((std::is_same<decltype(obj.quot), IntType>::value), "");
+ static_assert((std::is_same<decltype(obj.rem), IntType>::value), "");
+ ((void) obj);
+};
+
int main()
{
std::size_t s = 0;
- std::div_t d;
- std::ldiv_t ld;
- std::lldiv_t lld;
+ ((void)s);
+ static_assert((std::is_same<std::size_t, decltype(sizeof(int))>::value), "");
+ test_div_struct<std::div_t, int>();
+ test_div_struct<std::ldiv_t, long>();
+ test_div_struct<std::lldiv_t, long long>();
char** endptr = 0;
static_assert((std::is_same<decltype(std::atof("")), double>::value), "");
static_assert((std::is_same<decltype(std::atoi("")), int>::value), "");