]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/18_support/type_info/fundamental.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 18_support / type_info / fundamental.cc
1 // { dg-options "-std=gnu++11" }
2 // { dg-require-effective-target dfp }
3
4 // 2011-02-23 Benjamin Kosnik <bkoz@redhat.com>
5 //
6 // Copyright (C) 2011-2016 Free Software Foundation, Inc.
7 //
8 // This file is part of the GNU ISO C++ Library. This library is free
9 // software; you can redistribute it and/or modify it under the
10 // terms of the GNU General Public License as published by the
11 // Free Software Foundation; either version 3, or (at your option)
12 // any later version.
13
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18
19 // You should have received a copy of the GNU General Public License along
20 // with this library; see the file COPYING3. If not see
21 // <http://www.gnu.org/licenses/>.
22
23 #include <string>
24 #include <typeinfo>
25 #include <decimal/decimal>
26
27 template<typename _Tp>
28 std::string
29 gen_type_info()
30 {
31 std::string s1 = typeid(_Tp).name();
32 std::string s2 = typeid(_Tp*).name();
33 std::string s3 = typeid(const _Tp*).name();
34 return std::max(std::max(s1, s2), s3);
35 }
36
37 // libstdc++/43622, others
38 int main()
39 {
40 gen_type_info<bool>();
41 gen_type_info<char>();
42 gen_type_info<signed char>();
43 gen_type_info<unsigned char>();
44 gen_type_info<short>();
45 gen_type_info<unsigned short>();
46 gen_type_info<int>();
47 gen_type_info<unsigned int>();
48 gen_type_info<long>();
49 gen_type_info<unsigned long>();
50 gen_type_info<long long>();
51 gen_type_info<unsigned long long>();
52 gen_type_info<wchar_t>();
53 gen_type_info<char16_t>();
54 gen_type_info<char32_t>();
55
56 gen_type_info<float>();
57 gen_type_info<double>();
58 gen_type_info<long double>();
59
60 gen_type_info<void>();
61
62 gen_type_info<std::nullptr_t>();
63
64 // decimal
65 gen_type_info<std::decimal::decimal32>();
66 gen_type_info<std::decimal::decimal64>();
67 gen_type_info<std::decimal::decimal128>();
68
69 // attributes
70 #if 0
71 typedef int ti_type __attribute__((__mode__(TI)));
72 gen_type_info<ti_type>();
73
74 typedef float tf_type __attribute__((__mode__(TF)));
75 gen_type_info<tf_type>();
76 #endif
77
78 return 0;
79 }