Home | History | Annotate | Download | only in support.types
      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 #include <cstddef>
     11 #include <type_traits>
     12 
     13 // ptrdiff_t should:
     14 
     15 //  1. be in namespace std.
     16 //  2. be the same sizeof as void*.
     17 //  3. be a signed integral.
     18 
     19 int main()
     20 {
     21     static_assert(sizeof(std::ptrdiff_t) == sizeof(void*),
     22                   "sizeof(std::ptrdiff_t) == sizeof(void*)");
     23     static_assert(std::is_signed<std::ptrdiff_t>::value,
     24                   "std::is_signed<std::ptrdiff_t>::value");
     25     static_assert(std::is_integral<std::ptrdiff_t>::value,
     26                   "std::is_integral<std::ptrdiff_t>::value");
     27 }
     28