]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/is_copy_constructible/value.cc
testsuite_tr1.h (test_category, [...]): constexpr in c++11 mode.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / is_copy_constructible / value.cc
1 // { dg-options "-std=gnu++11" }
2 // { dg-do compile }
3 //
4 // Copyright (C) 2011-2013 Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
20
21 #include <type_traits>
22 #include <testsuite_tr1.h>
23
24 void test01()
25 {
26 using std::is_copy_constructible;
27 using namespace __gnu_test;
28
29 // Positive tests.
30 static_assert(test_category<is_copy_constructible, int>(true), "");
31 static_assert(test_category<is_copy_constructible, float>(true), "");
32 static_assert(test_category<is_copy_constructible, EnumType>(true), "");
33 static_assert(test_category<is_copy_constructible, int*>(true), "");
34 static_assert(test_category<is_copy_constructible, int(*)(int)>(true), "");
35 static_assert(test_category<is_copy_constructible,
36 int (ClassType::*)>(true), "");
37 static_assert(test_category<is_copy_constructible,
38 int (ClassType::*) (int)>(true), "");
39
40 static_assert(test_property<is_copy_constructible,
41 NoexceptCopyConsClass>(true), "");
42 static_assert(test_property<is_copy_constructible,
43 const NoexceptCopyConsClass>(true), "");
44 static_assert(test_property<is_copy_constructible,
45 ThrowCopyConsClass>(true), "");
46 static_assert(test_property<is_copy_constructible,
47 ExceptCopyConsClass>(true), "");
48
49 // Negative tests.
50 static_assert(test_category<is_copy_constructible, void>(false), "");
51 static_assert(test_category<is_copy_constructible, int[2]>(false), "");
52 static_assert(test_category<is_copy_constructible, int[]>(false), "");
53 static_assert(test_category<is_copy_constructible, float[][3]>(false), "");
54 static_assert(test_category<is_copy_constructible,
55 EnumType[2][3][4]>(false), "");
56 static_assert(test_category<is_copy_constructible, int*[3]>(false), "");
57 static_assert(test_category<is_copy_constructible,
58 int(*[][2])(int)>(false), "");
59 static_assert(test_category<is_copy_constructible,
60 int (ClassType::*[2][3])>(false), "");
61 static_assert(test_category<is_copy_constructible,
62 int (ClassType::*[][2][3]) (int)>(false), "");
63 static_assert(test_category<is_copy_constructible,
64 ClassType(unsigned) const &>(false), "");
65 static_assert(test_category<is_copy_constructible,
66 bool(ClassType) const>(false), "");
67 static_assert(test_category<is_copy_constructible,
68 bool(...) &&>(false), "");
69 static_assert(test_category<is_copy_constructible,
70 EnumType(int, ...)>(false), "");
71
72 static_assert(test_property<is_copy_constructible,
73 volatile NoexceptCopyConsClass>(false), "");
74 }