277 lines · cpp
1#include <cstddef>2#include <cstdint>3template <typename... Ts> struct t1 {};4template <typename... Ts> struct t2;5struct udt {};6namespace ns {7struct udt {};8namespace inner {9template <typename T> struct ttp {};10struct udt {};11} // namespace inner12template <template <typename> class T> void ttp_user() {}13enum Enumeration : int { Enumerator1, Enumerator2, Enumerator3 = 1 };14enum class EnumerationClass { Enumerator1, Enumerator2, Enumerator3 = 1 };15enum : int { AnonEnum1, AnonEnum2, AnonEnum3 = 1 };16enum EnumerationSmall : unsigned char { kNeg = 0xff };17} // namespace ns18template <typename... Ts> void f1() {19 t1<Ts...> v1;20 t2<Ts...> *v2;21}22template <bool b, int i> void f2() {}23template <typename T, T... A> void f3() {}24template <typename T, unsigned = 3> void f4() {}25template <typename T, bool b = false> struct t3 {};26extern template class t3<int>;27template class t3<int>;28struct outer_class {29 struct inner_class {};30};31int i = 3;32template <unsigned N> struct t4 {};33namespace {34struct t5 {};35enum LocalEnum { LocalEnum1 };36} // namespace37template <typename... T1, typename T2 = int> void f5() {}38template <typename T1, typename... T2> void f6() {}39struct t6 {40 template <typename T> void operator<<(int) {}41 template <typename T> void operator<(int) {}42 template <typename T> void operator<=(int) {}43 template <typename T = int> operator t1<float> *() { return nullptr; }44 template <typename T> void operator-(int) {}45 template <typename T> void operator*(int) {}46 template <typename T> void operator/(int) {}47 template <typename T> void operator%(int) {}48 template <typename T> void operator^(int) {}49 template <typename T> void operator&(int) {}50 template <typename T> void operator|(int) {}51 template <typename T> void operator~() {}52 template <typename T> void operator!() {}53 template <typename T> void operator=(int) {}54 template <typename T> void operator>(int) {}55 template <typename T> void operator,(int) {}56 template <typename T> void operator()() {}57 template <typename T> void operator[](int) {}58 template <typename T> void operator<=>(int) {}59 template <typename T> void *operator new(std::size_t, T) {60 __builtin_unreachable();61 }62 template <typename T> void operator delete(void *, T) {}63 template <typename T> void *operator new[](std::size_t, T) {64 __builtin_unreachable();65 }66 template <typename T> void operator delete[](void *, T) {}67 template <typename T> int operator co_await() { __builtin_unreachable(); }68};69void operator"" _suff(unsigned long long) {}70template <template <typename...> class T> void f7() {}71template <template <typename...> class T, typename T2> void f8() {}72template <typename T> struct t7;73using t7i = t7<int>;74template <typename T> struct __attribute__((__preferred_name__(t7i))) t7 {};75struct t8 {76 void mem();77};78namespace ns {79inline namespace inl {80template <typename T> struct t9 {};81} // namespace inl82} // namespace ns83template <typename T> void (*f9())() { return nullptr; }84struct t10 {85 template <typename T = void> t10() {}86};87 88template <typename T> void operator_not_really() {}89 90template <typename T, T... A> struct t11 {};91 92struct t12 {93 t11<LocalEnum, LocalEnum1> v1;94};95 96template <decltype(ns::AnonEnum1)> void f10() {}97 98template <typename T, T V> void f11() {}99 100int main() {101 struct {102 } A;103 auto L = [] {};104 f1<int>();105 f1<float>();106 f1<bool>();107 f1<double>();108 f1<long>();109 f1<short>();110 f1<unsigned>();111 f1<unsigned long long>();112 f1<long long>();113 f1<udt>();114 f1<ns::udt>();115 f1<ns::udt *>();116 f1<ns::inner::udt>();117 f1<t1<int>>();118 f1<int, float>();119 f1<int *>();120 f1<int &>();121 f1<int &&>();122 f1<const int>();123 f1<int[3]>();124 f1<void>();125 f1<outer_class::inner_class>();126 f1<unsigned long>();127 f2<true, 3>();128 f3<ns::Enumeration, ns::Enumerator3, (ns::Enumeration)2>();129 f3<ns::EnumerationClass, ns::EnumerationClass::Enumerator3,130 (ns::EnumerationClass)2>();131 f3<ns::EnumerationSmall, ns::kNeg>();132 f3<decltype(ns::AnonEnum1), ns::AnonEnum3, (decltype(ns::AnonEnum1))2>();133 f3<LocalEnum, LocalEnum1>();134 f3<int *, &i>();135 f3<int *, nullptr>();136 t4<3> v2;137 f3<unsigned long, 1>();138 f3<unsigned long long, 1>();139 f3<long, 1>();140 f3<unsigned int, 1>();141 f3<short, 1>();142 f3<unsigned char, (char)0>();143 f3<signed char, (char)0>();144 f3<unsigned short, 1, 2>();145 f3<char, 0, 1, 6, 7, 13, 14, 31, 32, 33, (char)127, (char)128>();146 f3<__int128, ((__int128)9223372036854775807) * 2>();147 f4<unsigned int>();148 f1<t3<int>>();149 f1<t3<t3<int>>>();150 f1<decltype(L)>();151 t3<decltype(L)> v1;152 f1<t3<t3<decltype(L)>>>();153 f1<int(float)>();154 f1<void(...)>();155 f1<void(int, ...)>();156 f1<const int &>();157 f1<const int *&>();158 f1<t5>();159 f1<decltype(nullptr)>();160 f1<long *, long *>();161 f1<long *, udt *>();162 f1<void *const>();163 f1<const void *const *>();164 f1<void()>();165 f1<void (*)()>();166 f1<decltype(&L)>();167 f1<decltype(A)>();168 f1<decltype(&A)>();169 f5<t1<int>>();170 f5<>();171 f6<t1<int>>();172 f1<>();173 f1<const void *, const void *>();174 f1<t1<int *> *>();175 f1<int *[]>();176 t6 v6;177 v6.operator<< <int>(1);178 v6.operator< <int>(1);179 v6.operator<= <int>(1);180 v6.operator t1<float> *();181 v6.operator- <int>(3);182 v6.operator* <int>(3);183 v6.operator/ <int>(3);184 v6.operator% <int>(3);185 v6.operator^ <int>(3);186 v6.operator& <int>(3);187 v6.operator| <int>(3);188 v6.operator~ <int>();189 v6.operator! <int>();190 v6.operator= <int>(3);191 v6.operator><int>(3);192 v6.operator, <int>(3);193 v6.operator()<int>();194 v6.operator[]<int>(3);195 v6.operator<=> <int>(3);196 t6::operator new(0, 0);197 t6::operator new[](0, 0);198 t6::operator delete(nullptr, 0);199 t6::operator delete[](nullptr, 0);200 v6.operator co_await <int>();201 42_suff;202 struct t7 {};203 f1<t7>();204 f1<int (&)[3]>();205 f1<int (*)[3]>();206 f7<t1>();207 f8<t1, int>();208 using namespace ns;209 ttp_user<inner::ttp>();210 f1<int *, decltype(nullptr) *>();211 t7i x;212 f1<t7i>();213 f7<ns::inl::t9>();214 f1<_Atomic(int)>();215 f1<int, long, volatile char>();216 f1<__attribute__((__vector_size__(sizeof(int) * 2))) int>();217 f1<int *const volatile>();218 f1<const volatile void>();219 f1<t1<decltype(L)>>();220 t10 v3;221 f1<void (::udt::*)() const>();222 f1<void (::udt::*)() volatile &>();223 f1<void (::udt::*)() const volatile &&>();224 f9<int>();225 f1<void (*const)()>();226 f1<char const(&)[1]>();227 f1<void() const &>();228 f1<void() volatile &&>();229 f1<void() const volatile>();230 f1<int *const[1]>();231 f1<int *const(&)[1]>();232 f1<void (::udt::*const &)()>();233 f1<void (*(int))(float)>();234 f1<t1<int>[1]>();235 f1<void (*)() noexcept>();236 f1<void(decltype(A))>();237 struct t8 {238 decltype(A) m;239 };240 f1<void(t8, decltype(A))>();241 f1<void(t8)>();242 operator_not_really<int>();243 t12 v4;244 f11<_BitInt(3), 2>();245 f11<const unsigned _BitInt(5), 2>();246 f11<_BitInt(65), 2>();247 f11<const unsigned _BitInt(65), 2>();248 f1<void(t1<>, t1<>)>();249 f1<int t1<>::*>();250 void fcc() __attribute__((swiftcall));251 f1<decltype(fcc)>();252 int fnrt() __attribute__((noreturn));253 f1<decltype(fnrt)>();254 f10<ns::AnonEnum1>();255}256void t8::mem() {257 struct t7 {};258 f1<t7>();259 f1<decltype(&t8::mem)>();260}261namespace complex_type_units {262void external_function();263namespace {264struct internal_type;265}266template <void (*)() = external_function> struct t2;267template <typename = t2<>> class t3 {};268template <typename = internal_type, typename = t3<>> struct t4 {};269struct t5 {270 t4<> v1;271};272void f1() {273 t5 v1;274 t3<> v2;275}276} // namespace complex_type_units277