]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/common_type/requirements/typedefs-2.cc
0737755e06af7ecfc7fbceebc28eac49c114dbb6
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / common_type / requirements / typedefs-2.cc
1 // { dg-do compile { target c++11 } }
2 // 2009-11-12 Paolo Carlini <paolo.carlini@oracle.com>
3 //
4 // Copyright (C) 2009-2024 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
23 // DR 1255.
24 void test01()
25 {
26 using std::common_type;
27 using std::is_same;
28
29 static_assert( is_same<common_type<void>::type, void>(),
30 "common_type<void>" );
31 static_assert( is_same<common_type<const void>::type, void>(),
32 "common_type<const void>" );
33 static_assert( is_same<common_type<volatile void>::type, void>(),
34 "common_type<volatile void>" );
35 static_assert( is_same<common_type<const volatile void>::type, void>(),
36 "common_type<const volatile void>" );
37
38 static_assert( is_same<common_type<void, void>::type, void>(),
39 "common_type<void, void>" );
40 static_assert( is_same<common_type<void, const void>::type, void>(),
41 "common_type<void, const void>" );
42 static_assert( is_same<common_type<void, volatile void>::type, void>(),
43 "common_type<void, volatile void>" );
44 static_assert( is_same<common_type<void, const volatile void>::type, void>(),
45 "common_type<void, const volatile void>" );
46 static_assert( is_same<common_type<const void, void>::type, void>(),
47 "common_type<const void, void>" );
48 static_assert( is_same<common_type<const void, const void>::type, void>(),
49 "common_type<const void, const void>" );
50 static_assert( is_same<common_type<const void, volatile void>::type, void>(),
51 "common_type<const void, volatile void>" );
52 static_assert( is_same<common_type<const void, const volatile void>::type,
53 void>(), "common_type<const void, const volatile void>" );
54 static_assert( is_same<common_type<volatile void, void>::type, void>(),
55 "common_type<volatile void, void>" );
56 static_assert( is_same<common_type<volatile void, volatile void>::type,
57 void>(), "common_type<volatile void, volatile void>" );
58 static_assert( is_same<common_type<volatile void, const void>::type,
59 void>(), "common_type<volatile void, const void>" );
60 static_assert( is_same<common_type<volatile void, const volatile void>::type,
61 void>(), "common_type<volatile void, const volatile void>" );
62 static_assert( is_same<common_type<const volatile void, void>::type, void>(),
63 "common_type<const volatile void, const volatile void>" );
64 static_assert( is_same<common_type<const volatile void, const void>::type,
65 void>(), "common_type<const volatile void, const void>" );
66 static_assert( is_same<common_type<const volatile void, volatile void>::type,
67 void>(), "common_type<const volatile void, volatile void>" );
68 static_assert( is_same<common_type<const volatile void, const volatile void>::type,
69 void>(),
70 "common_type<const volatile void, const volatile void>" );
71 }