common_type.pass.cpp revision f5256e16dfc425c1d466f6308d4026d529ce9e0b
1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// type_traits
11
12// common_type
13
14#include <type_traits>
15
16int main()
17{
18    static_assert((std::is_same<std::common_type<int>::type, int>::value), "");
19    static_assert((std::is_same<std::common_type<char>::type, char>::value), "");
20
21    static_assert((std::is_same<std::common_type<double, char>::type, double>::value), "");
22    static_assert((std::is_same<std::common_type<short, char>::type, int>::value), "");
23
24    static_assert((std::is_same<std::common_type<double, char, long long>::type, double>::value), "");
25    static_assert((std::is_same<std::common_type<unsigned, char, long long>::type, long long>::value), "");
26}
27