1// { dg-options "-std=gnu++11" }
2// { dg-do compile }
3// 2009-11-12  Paolo Carlini  <paolo.carlini@oracle.com>
4//
5// Copyright (C) 2009-2015 Free Software Foundation, Inc.
6//
7// This file is part of the GNU ISO C++ Library.  This library is free
8// software; you can redistribute it and/or modify it under the
9// terms of the GNU General Public License as published by the
10// Free Software Foundation; either version 3, or (at your option)
11// any later version.
12//
13// This library is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License along
19// with this library; see the file COPYING3.  If not see
20// <http://www.gnu.org/licenses/>.
21
22#include <type_traits>
23
24// DR 1255.
25void test01()
26{
27  using std::common_type;
28  using std::is_same;
29
30  static_assert( is_same<common_type<void>::type, void>(),
31                 "common_type<void>" );
32  static_assert( is_same<common_type<const void>::type, void>(),
33                 "common_type<const void>" );
34  static_assert( is_same<common_type<volatile void>::type, void>(),
35                 "common_type<volatile void>" );
36  static_assert( is_same<common_type<const volatile void>::type, void>(),
37                 "common_type<const volatile void>" );
38
39  static_assert( is_same<common_type<void, void>::type, void>(),
40                 "common_type<void, void>" );
41  static_assert( is_same<common_type<void, const void>::type, void>(),
42                 "common_type<void, const void>" );
43  static_assert( is_same<common_type<void, volatile void>::type, void>(),
44                 "common_type<void, volatile void>" );
45  static_assert( is_same<common_type<void, const volatile void>::type, void>(),
46                 "common_type<void, const volatile void>" );
47  static_assert( is_same<common_type<const void, void>::type, void>(),
48                 "common_type<const void, void>" );
49  static_assert( is_same<common_type<const void, const void>::type, void>(),
50                 "common_type<const void, const void>" );
51  static_assert( is_same<common_type<const void, volatile void>::type, void>(),
52                 "common_type<const void, volatile void>" );
53  static_assert( is_same<common_type<const void, const volatile void>::type,
54	           void>(), "common_type<const void, const volatile void>" );
55  static_assert( is_same<common_type<volatile void, void>::type, void>(),
56                 "common_type<volatile void, void>" );
57  static_assert( is_same<common_type<volatile void, volatile void>::type,
58	           void>(), "common_type<volatile void, volatile void>" );
59  static_assert( is_same<common_type<volatile void, const void>::type,
60	           void>(), "common_type<volatile void, const void>" );
61  static_assert( is_same<common_type<volatile void, const volatile void>::type,
62	           void>(), "common_type<volatile void, const volatile void>" );
63  static_assert( is_same<common_type<const volatile void, void>::type, void>(),
64	         "common_type<const volatile void, const volatile void>" );
65  static_assert( is_same<common_type<const volatile void, const void>::type,
66	           void>(), "common_type<const volatile void, const void>" );
67  static_assert( is_same<common_type<const volatile void, volatile void>::type,
68	           void>(), "common_type<const volatile void, volatile void>" );
69  static_assert( is_same<common_type<const volatile void, const volatile void>::type,
70	           void>(),
71	         "common_type<const volatile void, const volatile void>" );
72}
73