xref: /llvm-project/clang/test/SemaCXX/libstdcxx_transform_type_traits_hack.cpp (revision e137fb6fb85b41978814e64eae652d05688bcca5)
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++11 -fms-extensions -Wno-microsoft %s
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++14 -fms-extensions -Wno-microsoft %s
3 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++1z -fms-extensions -Wno-microsoft %s
4 
5 // libstdc++ uses __remove_cv as an alias, so we make our transform type traits alias-revertible
6 template <class T, class U>
7 struct Same {
8   static constexpr auto value = __is_same(T, U);
9 };
10 
11 template <class T>
12 using __remove_const = int; // expected-warning{{keyword '__remove_const' will be made available as an identifier here}}
13 template <class T>
14 using A = Same<__remove_const<T>, __remove_const<T>>;
15 
16 template <class T>
17 using __remove_restrict = int; // expected-warning{{keyword '__remove_restrict' will be made available as an identifier here}}
18 template <class T>
19 using B = Same<__remove_restrict<T>, __remove_restrict<T>>;
20 
21 template <class T>
22 using __remove_volatile = int; // expected-warning{{keyword '__remove_volatile' will be made available as an identifier here}}
23 template <class T>
24 using C = Same<__remove_volatile<T>, __remove_volatile<T>>;
25 
26 template <class T>
27 using __remove_cv = int; // expected-warning{{keyword '__remove_cv' will be made available as an identifier here}}
28 template <class T>
29 using D = Same<__remove_cv<T>, __remove_cv<T>>;
30 
31 template <class T>
32 using __add_pointer = int; // expected-warning{{keyword '__add_pointer' will be made available as an identifier here}}
33 template <class T>
34 using E = Same<__add_pointer<T>, __add_pointer<T>>;
35 
36 template <class T>
37 using __remove_pointer = int; // expected-warning{{keyword '__remove_pointer' will be made available as an identifier here}}
38 template <class T>
39 using F = Same<__remove_pointer<T>, __remove_pointer<T>>;
40 
41 template <class T>
42 using __add_lvalue_reference = int; // expected-warning{{keyword '__add_lvalue_reference' will be made available as an identifier here}}
43 template <class T>
44 using G = Same<__add_lvalue_reference<T>, __add_lvalue_reference<T>>;
45 
46 template <class T>
47 using __add_rvalue_reference = int; // expected-warning{{keyword '__add_rvalue_reference' will be made available as an identifier here}}
48 template <class T>
49 using H = Same<__add_rvalue_reference<T>, __add_rvalue_reference<T>>;
50 
51 template <class T>
52 using __remove_reference_t = int; // expected-warning{{keyword '__remove_reference_t' will be made available as an identifier here}}
53 template <class T>
54 using I = Same<__remove_reference_t<T>, __remove_reference_t<T>>;
55 
56 template <class T>
57 using __remove_cvref = int; // expected-warning{{keyword '__remove_cvref' will be made available as an identifier here}}
58 template <class T>
59 using J = Same<__remove_cvref<T>, __remove_cvref<T>>;
60 
61 template <class T>
62 using __decay = int; // expected-warning{{keyword '__decay' will be made available as an identifier here}}
63 template <class T>
64 using K = Same<__decay<T>, __decay<T>>;
65 
66 template <class T>
67 using __make_signed = int; // expected-warning{{keyword '__make_signed' will be made available as an identifier here}}
68 template <class T>
69 using L = Same<__make_signed<T>, __make_signed<T>>;
70 
71 template <class T>
72 using __make_unsigned = int; // expected-warning{{keyword '__make_unsigned' will be made available as an identifier here}}
73 template <class T>
74 using M = Same<__make_unsigned<T>, __make_unsigned<T>>;
75 
76 template <class T>
77 using __remove_extent = int; // expected-warning{{keyword '__remove_extent' will be made available as an identifier here}}
78 template <class T>
79 using N = Same<__remove_extent<T>, __remove_extent<T>>;
80 
81 template <class T>
82 using __remove_all_extents = int; // expected-warning{{keyword '__remove_all_extents' will be made available as an identifier here}}
83 template <class T>
84 using O = Same<__remove_all_extents<T>, __remove_all_extents<T>>;
85