; RUN: llvm-undname < %s | FileCheck %s
; CHECK-NOT: Invalid mangled name
?m@@3U?$J@UM@@$0A@@@A
; CHECK: struct J<struct M, 0> m
?m2@@3U?$K@UM@@$0?0@@A
; CHECK: struct K<struct M, -1> m2
?n@@3U?$J@UN@@$HA@@@A
; CHECK: struct J<struct N, {0}> n
?n2@@3U?$K@UN@@$0?0@@A
; CHECK: struct K<struct N, -1> n2
?o@@3U?$J@UO@@$IA@A@@@A
; CHECK: struct J<struct O, {0, 0}> o
?o2@@3U?$K@UO@@$FA@?0@@A
; CHECK: struct K<struct O, {0, -1}> o2
?p@@3U?$J@UP@@$JA@A@?0@@A
; CHECK: struct J<struct P, {0, 0, -1}> p
?p2@@3U?$K@UP@@$GA@A@?0@@A
; CHECK: struct K<struct P, {0, 0, -1}> p2
??0?$ClassTemplate@$J??_9MostGeneral@@$BA@AEA@M@3@@QAE@XZ
; CHECK: __thiscall ClassTemplate<{[thunk]: __thiscall MostGeneral::`vcall'{0, {flat}}, 0, 12, 4}>::ClassTemplate<{[thunk]: __thiscall MostGeneral::`vcall'{0, {flat}}, 0, 12, 4}>(void)