]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp
Vendor import of libc++ trunk r302418:
[FreeBSD/FreeBSD.git] / test / libcxx / language.support / support.dynamic / alloc.errors / new.badlength / bad_array_length.pass.cpp
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 // UNSUPPORTED: c++98, c++03, c++11
11 // XFAIL: availability
12
13 // XFAIL: availability=macosx10.12
14 // XFAIL: availability=macosx10.11
15 // XFAIL: availability=macosx10.10
16 // XFAIL: availability=macosx10.9
17 // XFAIL: availability=macosx10.7
18 // XFAIL: availability=macosx10.8
19
20 // test bad_array_length
21
22 #include <new>
23 #include <type_traits>
24 #include <cassert>
25
26 int main()
27 {
28     static_assert((std::is_base_of<std::bad_alloc, std::bad_array_length>::value),
29                   "std::is_base_of<std::bad_alloc, std::bad_array_length>::value");
30     static_assert(std::is_polymorphic<std::bad_array_length>::value,
31                  "std::is_polymorphic<std::bad_array_length>::value");
32     std::bad_array_length b;
33     std::bad_array_length b2 = b;
34     b2 = b;
35     const char* w = b2.what();
36     assert(w);
37 }