[clang] [llvm] Fix MSVC 1920+ auto NTTP mangling for pointers to members (PR #97007)
Max Winkler via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 27 22:59:10 PDT 2024
================
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -std=c++17 -fms-compatibility-version=19.20 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-windows-msvc | FileCheck --check-prefix=AFTER %s
+// RUN: %clang_cc1 -std=c++17 -fms-compatibility-version=19.14 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-windows-msvc | FileCheck --check-prefix=BEFORE %s
+
+template <auto a>
+class AutoParmTemplate {
+public:
+ AutoParmTemplate() {}
+};
+
+template <auto a>
+auto AutoFunc() {
+ return a;
+}
+
+void template_mangling() {
+
+ AutoParmTemplate<nullptr> auto_nullptr;
----------------
MaxEW707 wrote:
This is a separate file since `nullptr` gets mangled the same as an integer literal.
In VS2017 this gets mangled with the `$M <type>` so clang emits an error for emitting the same mangled name definition for two different objects if these test is inside `mangle-ms-auto-templates.cpp` which has tests for mangling integer literals.
VS2017 gets around this by erroneously putting all the definitions into COMDAT sections which clang does not do at the moment when trying to be VS2017 compatible.
https://github.com/llvm/llvm-project/pull/97007
More information about the cfe-commits
mailing list