stddef_h.pass.cpp revision b64f8b07c104c6cc986570ac8ee0ed16a9f23976
1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10// <stddef.h> 11 12#include <stddef.h> 13#include <type_traits> 14 15#ifndef NULL 16#error NULL not defined 17#endif 18 19#ifndef offsetof 20#error offsetof not defined 21#endif 22 23int main() 24{ 25 static_assert(sizeof(size_t) == sizeof(void*), 26 "sizeof(size_t) == sizeof(void*)"); 27 static_assert(std::is_unsigned<size_t>::value, 28 "std::is_unsigned<size_t>::value"); 29 static_assert(std::is_integral<size_t>::value, 30 "std::is_integral<size_t>::value"); 31 static_assert(sizeof(ptrdiff_t) == sizeof(void*), 32 "sizeof(ptrdiff_t) == sizeof(void*)"); 33 static_assert(std::is_signed<ptrdiff_t>::value, 34 "std::is_signed<ptrdiff_t>::value"); 35 static_assert(std::is_integral<ptrdiff_t>::value, 36 "std::is_integral<ptrdiff_t>::value"); 37} 38