[clang] [llvm] Fix MSVC 1920+ auto NTTP mangling for pointers to members (PR #97007)

Max Winkler via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 23:08:05 PDT 2024


================
@@ -1767,12 +1805,12 @@ void MicrosoftCXXNameMangler::mangleTemplateArg(const TemplateDecl *TD,
       const CXXRecordDecl *RD = MPT->getMostRecentCXXRecordDecl();
       if (MPT->isMemberFunctionPointerType() &&
           !isa<FunctionTemplateDecl>(TD)) {
-        mangleMemberFunctionPointer(RD, nullptr);
+        mangleMemberFunctionPointer(RD, nullptr, nullptr, QualType());
         return;
       }
       if (MPT->isMemberDataPointer()) {
         if (!isa<FunctionTemplateDecl>(TD)) {
-          mangleMemberDataPointer(RD, nullptr);
+          mangleMemberDataPointer(RD, nullptr, nullptr, QualType());
----------------
MaxEW707 wrote:

These use cases appear to be added from, https://github.com/llvm/llvm-project/commit/5518a9d7673bfe55b4110bea049140316d032fbf, with support for C++20 nttp changes.

>From looking at the code we only hit this path when compiling for C++20 and also already properly mangle according to VS2019+ by doing `$M <type>` elsewhere.

I intend to take a look at C++20 NTTP after this PR and then take a more holistic look to see if we can better merge the C++11-17 and C++20 mangling paths in `MicrosoftMangle.cpp`.

https://github.com/llvm/llvm-project/pull/97007


More information about the llvm-commits mailing list