Home | History | Annotate | Download | only in new.badlength
      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 // test bad_array_length
     11 
     12 #include <new>
     13 #include <type_traits>
     14 #include <cassert>
     15 
     16 int main()
     17 {
     18 #if __LIBCPP_STD_VER > 11
     19     static_assert((std::is_base_of<std::bad_alloc, std::bad_array_length>::value),
     20                   "std::is_base_of<std::bad_alloc, std::bad_array_length>::value");
     21     static_assert(std::is_polymorphic<std::bad_array_length>::value,
     22                  "std::is_polymorphic<std::bad_array_length>::value");
     23     std::bad_array_length b;
     24     std::bad_array_length b2 = b;
     25     b2 = b;
     26     const char* w = b2.what();
     27     assert(w);
     28 #endif
     29 }
     30