diff options
-rw-r--r-- | clang/lib/AST/MicrosoftMangle.cpp | 3 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/mangle-ms-templates.cpp | 14 |
2 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 22d4f343a10..a02402580d9 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -1063,6 +1063,9 @@ void MicrosoftCXXNameMangler::mangleExpression(const Expr *E) { return; } + // Look through no-op casts like template parameter substitutions. + E = E->IgnoreParenNoopCasts(Context.getASTContext()); + const CXXUuidofExpr *UE = nullptr; if (const UnaryOperator *UO = dyn_cast<UnaryOperator>(E)) { if (UO->getOpcode() == UO_AddrOf) diff --git a/clang/test/CodeGenCXX/mangle-ms-templates.cpp b/clang/test/CodeGenCXX/mangle-ms-templates.cpp index 24e4f4abb87..31fda2046c4 100644 --- a/clang/test/CodeGenCXX/mangle-ms-templates.cpp +++ b/clang/test/CodeGenCXX/mangle-ms-templates.cpp @@ -262,3 +262,17 @@ void CallFunctionDefinedWithInjectedName() { FunctionDefinedWithInjectedName(TypeWithFriendDefinition<int>()); } // CHECK: @"\01?FunctionDefinedWithInjectedName@@YAXU?$TypeWithFriendDefinition@H@@@Z" + +// We need to be able to feed GUIDs through a couple rounds of template +// substitution. +template <const _GUID *G> +struct UUIDType3 { + void foo() {} +}; +template <const _GUID *G> +struct UUIDType4 : UUIDType3<G> { + void bar() { UUIDType4::foo(); } +}; +template struct UUIDType4<&__uuidof(uuid)>; +// CHECK: "\01?bar@?$UUIDType4@$1?_GUID_12345678_1234_1234_1234_1234567890ab@@3U__s_GUID@@B@@QAEXXZ" +// CHECK: "\01?foo@?$UUIDType3@$1?_GUID_12345678_1234_1234_1234_1234567890ab@@3U__s_GUID@@B@@QAEXXZ" |