; These tests are based on clang/test/CodeGenCXX/mangle-ms-cxx11.cpp
; RUN: llvm-undname < %s | FileCheck %s
; CHECK-NOT: Invalid mangled name
?f@@3V?$C@H@@A
; CHECK: class C<int> f
??0?$Class@VTypename@@@@QAE@XZ
; CHECK: __thiscall Class<class Typename>::Class<class Typename>(void)
??0?$Class@VTypename@@@@QEAA@XZ
; CHECK: __cdecl Class<class Typename>::Class<class Typename>(void)
??0?$Class@$$CBVTypename@@@@QAE@XZ
; CHECK: __thiscall Class<class Typename const>::Class<class Typename const>(void)
??0?$Class@$$CBVTypename@@@@QEAA@XZ
; CHECK: __cdecl Class<class Typename const>::Class<class Typename const>(void)
??0?$Class@$$CCVTypename@@@@QAE@XZ
; CHECK: __thiscall Class<class Typename volatile>::Class<class Typename volatile>(void)
??0?$Class@$$CCVTypename@@@@QEAA@XZ
; CHECK: __cdecl Class<class Typename volatile>::Class<class Typename volatile>(void)
??0?$Class@$$CDVTypename@@@@QAE@XZ
; CHECK: __thiscall Class<class Typename const volatile>::Class<class Typename const volatile>(void)
??0?$Class@$$CDVTypename@@@@QEAA@XZ
; CHECK: __cdecl Class<class Typename const volatile>::Class<class Typename const volatile>(void)
??0?$Class@V?$Nested@VTypename@@@@@@QAE@XZ
; CHECK: __thiscall Class<class Nested<class Typename>>::Class<class Nested<class Typename>>(void)
??0?$Class@V?$Nested@VTypename@@@@@@QEAA@XZ
; CHECK: __cdecl Class<class Nested<class Typename>>::Class<class Nested<class Typename>>(void)
??0?$Class@QAH@@QAE@XZ
; CHECK: __thiscall Class<int *const>::Class<int *const>(void)
??0?$Class@QEAH@@QEAA@XZ
; CHECK: __cdecl Class<int *const>::Class<int *const>(void)
??0?$Class@$$A6AHXZ@@QAE@XZ
; CHECK: __thiscall Class<int __cdecl(void)>::Class<int __cdecl(void)>(void)
??0?$Class@$$A6AHXZ@@QEAA@XZ
; CHECK: __cdecl Class<int __cdecl(void)>::Class<int __cdecl(void)>(void)
??0?$Class@$$BY0A@H@@QAE@XZ
; CHECK: __thiscall Class<int[]>::Class<int[]>(void)
??0?$Class@$$BY0A@H@@QEAA@XZ
; CHECK: __cdecl Class<int[]>::Class<int[]>(void)
??0?$Class@$$BY04H@@QAE@XZ
; CHECK: __thiscall Class<int[5]>::Class<int[5]>(void)
??0?$Class@$$BY04H@@QEAA@XZ
; CHECK: __cdecl Class<int[5]>::Class<int[5]>(void)
??0?$Class@$$BY04$$CBH@@QAE@XZ
; CHECK: __thiscall Class<int const[5]>::Class<int const[5]>(void)
??0?$Class@$$BY04$$CBH@@QEAA@XZ
; CHECK: __cdecl Class<int const[5]>::Class<int const[5]>(void)
??0?$Class@$$BY04QAH@@QAE@XZ
; CHECK: __thiscall Class<int *const[5]>::Class<int *const[5]>(void)
??0?$Class@$$BY04QEAH@@QEAA@XZ
; CHECK: __cdecl Class<int *const[5]>::Class<int *const[5]>(void)
??0?$BoolTemplate@$0A@@@QAE@XZ
; CHECK: __thiscall BoolTemplate<0>::BoolTemplate<0>(void)
??0?$BoolTemplate@$0A@@@QEAA@XZ
; CHECK: __cdecl BoolTemplate<0>::BoolTemplate<0>(void)
??0?$BoolTemplate@$00@@QAE@XZ
; CHECK: __thiscall BoolTemplate<1>::BoolTemplate<1>(void)
??0?$BoolTemplate@$00@@QEAA@XZ
; CHECK: __cdecl BoolTemplate<1>::BoolTemplate<1>(void)
??$Foo@H@?$BoolTemplate@$00@@QAEXH@Z
; CHECK: void __thiscall BoolTemplate<1>::Foo<int>(int)
??$Foo@H@?$BoolTemplate@$00@@QEAAXH@Z
; CHECK: void __cdecl BoolTemplate<1>::Foo<int>(int)
??0?$IntTemplate@$0A@@@QAE@XZ
; CHECK: __thiscall IntTemplate<0>::IntTemplate<0>(void)
??0?$IntTemplate@$0A@@@QEAA@XZ
; CHECK: __cdecl IntTemplate<0>::IntTemplate<0>(void)
??0?$IntTemplate@$04@@QAE@XZ
; CHECK: __thiscall IntTemplate<5>::IntTemplate<5>(void)
??0?$IntTemplate@$04@@QEAA@XZ
; CHECK: __cdecl IntTemplate<5>::IntTemplate<5>(void)
??0?$IntTemplate@$0L@@@QAE@XZ
; CHECK: __thiscall IntTemplate<11>::IntTemplate<11>(void)
??0?$IntTemplate@$0L@@@QEAA@XZ
; CHECK: __cdecl IntTemplate<11>::IntTemplate<11>(void)
??0?$IntTemplate@$0BAA@@@QAE@XZ
; CHECK: __thiscall IntTemplate<256>::IntTemplate<256>(void)
??0?$IntTemplate@$0BAA@@@QEAA@XZ
; CHECK: __cdecl IntTemplate<256>::IntTemplate<256>(void)
??0?$IntTemplate@$0CAB@@@QAE@XZ
; CHECK: __thiscall IntTemplate<513>::IntTemplate<513>(void)
??0?$IntTemplate@$0CAB@@@QEAA@XZ
; CHECK: __cdecl IntTemplate<513>::IntTemplate<513>(void)
??0?$IntTemplate@$0EAC@@@QAE@XZ
; CHECK: __thiscall IntTemplate<1026>::IntTemplate<1026>(void)
??0?$IntTemplate@$0EAC@@@QEAA@XZ
; CHECK: __cdecl IntTemplate<1026>::IntTemplate<1026>(void)
??0?$IntTemplate@$0PPPP@@@QAE@XZ
; CHECK: __thiscall IntTemplate<65535>::IntTemplate<65535>(void)
??0?$IntTemplate@$0PPPP@@@QEAA@XZ
; CHECK: __cdecl IntTemplate<65535>::IntTemplate<65535>(void)
??0?$IntTemplate@$0?0@@QAE@XZ
; CHECK: __thiscall IntTemplate<-1>::IntTemplate<-1>(void)
??0?$IntTemplate@$0?0@@QEAA@XZ
; CHECK: __cdecl IntTemplate<-1>::IntTemplate<-1>(void)
??0?$IntTemplate@$0?8@@QAE@XZ
; CHECK: __thiscall IntTemplate<-9>::IntTemplate<-9>(void)
??0?$IntTemplate@$0?8@@QEAA@XZ
; CHECK: __cdecl IntTemplate<-9>::IntTemplate<-9>(void)
??0?$IntTemplate@$0?9@@QAE@XZ
; CHECK: __thiscall IntTemplate<-10>::IntTemplate<-10>(void)
??0?$IntTemplate@$0?9@@QEAA@XZ
; CHECK: __cdecl IntTemplate<-10>::IntTemplate<-10>(void)
??0?$IntTemplate@$0?L@@@QAE@XZ
; CHECK: __thiscall IntTemplate<-11>::IntTemplate<-11>(void)
??0?$IntTemplate@$0?L@@@QEAA@XZ
; CHECK: __cdecl IntTemplate<-11>::IntTemplate<-11>(void)
??0?$UnsignedIntTemplate@$0PPPPPPPP@@@QAE@XZ
; CHECK: __thiscall UnsignedIntTemplate<4294967295>::UnsignedIntTemplate<4294967295>(void)
??0?$UnsignedIntTemplate@$0PPPPPPPP@@@QEAA@XZ
; CHECK: __cdecl UnsignedIntTemplate<4294967295>::UnsignedIntTemplate<4294967295>(void)
??0?$LongLongTemplate@$0?IAAAAAAAAAAAAAAA@@@QAE@XZ
; CHECK: __thiscall LongLongTemplate<-9223372036854775808>::LongLongTemplate<-9223372036854775808>(void)
??0?$LongLongTemplate@$0?IAAAAAAAAAAAAAAA@@@QEAA@XZ
; CHECK: __cdecl LongLongTemplate<-9223372036854775808>::LongLongTemplate<-9223372036854775808>(void)
??0?$LongLongTemplate@$0HPPPPPPPPPPPPPPP@@@QAE@XZ
; CHECK: __thiscall LongLongTemplate<9223372036854775807>::LongLongTemplate<9223372036854775807>(void)
??0?$LongLongTemplate@$0HPPPPPPPPPPPPPPP@@@QEAA@XZ
; CHECK: __cdecl LongLongTemplate<9223372036854775807>::LongLongTemplate<9223372036854775807>(void)
; -1 is indistinguishable from uint64_max in this encoding.
??0?$UnsignedLongLongTemplate@$0?0@@QAE@XZ
; CHECK: __thiscall UnsignedLongLongTemplate<-1>::UnsignedLongLongTemplate<-1>(void)
??0?$UnsignedLongLongTemplate@$0?0@@QEAA@XZ
; CHECK: __cdecl UnsignedLongLongTemplate<-1>::UnsignedLongLongTemplate<-1>(void)
??$foo@H@space@@YAABHABH@Z
; CHECK: int const & __cdecl space::foo<int>(int const &)
??$foo@H@space@@YAAEBHAEBH@Z
; CHECK: int const & __cdecl space::foo<int>(int const &)
??$FunctionPointerTemplate@$1?spam@@YAXXZ@@YAXXZ
; CHECK: void __cdecl FunctionPointerTemplate<&void __cdecl spam(void)>(void)
??$variadic_fn_template@HHHH@@YAXABH000@Z
; CHECK: void __cdecl variadic_fn_template<int, int, int, int>(int const &, int const &, int const &, int const &)
??$variadic_fn_template@HHD$$BY01D@@YAXABH0ABDAAY01$$CBD@Z
; CHECK: void __cdecl variadic_fn_template<int, int, char, char[2]>(int const &, int const &, char const &, char const (&)[2]
??0?$VariadicClass@HD_N@@QAE@XZ
; CHECK: __thiscall VariadicClass<int, char, bool>::VariadicClass<int, char, bool>(void)
??0?$VariadicClass@_NDH@@QAE@XZ
; CHECK: __thiscall VariadicClass<bool, char, int>::VariadicClass<bool, char, int>(void)
?template_template_fun@@YAXU?$Type@U?$Thing@USecond@@$00@@USecond@@@@@Z
; CHECK: void __cdecl template_template_fun(struct Type<struct Thing<struct Second, 1>, struct Second>)
??$template_template_specialization@$$A6AXU?$Type@U?$Thing@USecond@@$00@@USecond@@@@@Z@@YAXXZ
; CHECK: void __cdecl template_template_specialization<void __cdecl(struct Type<struct Thing<struct Second, 1>, struct Second>)>(void)
?f@@YAXU?$S1@$0A@@@@Z
; CHECK: void __cdecl f(struct S1<0>)
?recref@@YAXU?$type1@$E?inst@@3Urecord@@B@@@Z
; CHECK: void __cdecl recref(struct type1<struct record const inst>)
?fun@@YAXU?$UUIDType1@Uuuid@@$1?_GUID_12345678_1234_1234_1234_1234567890ab@@3U__s_GUID@@B@@@Z
; CHECK: void __cdecl fun(struct UUIDType1<struct uuid, &struct __s_GUID const _GUID_12345678_1234_1234_1234_1234567890ab>)
?fun@@YAXU?$UUIDType2@Uuuid@@$E?_GUID_12345678_1234_1234_1234_1234567890ab@@3U__s_GUID@@B@@@Z
; CHECK: void __cdecl fun(struct UUIDType2<struct uuid, struct __s_GUID const _GUID_12345678_1234_1234_1234_1234567890ab>)
?FunctionDefinedWithInjectedName@@YAXU?$TypeWithFriendDefinition@H@@@Z
; CHECK: void __cdecl FunctionDefinedWithInjectedName(struct TypeWithFriendDefinition<int>)
?bar@?$UUIDType4@$1?_GUID_12345678_1234_1234_1234_1234567890ab@@3U__s_GUID@@B@@QAEXXZ
; CHECK: void __thiscall UUIDType4<&struct __s_GUID const _GUID_12345678_1234_1234_1234_1234567890ab>::bar(void)
??$f@US@@$1?g@1@QEAAXXZ@@YAXXZ
; CHECK: void __cdecl f<struct S, &public: void __cdecl S::g(void)>(void)
??$?0N@?$Foo@H@@QEAA@N@Z
; CHECK: __cdecl Foo<int>::Foo<int><double>(double)