[clang] [clang] mangle placeholder for deduced type as a template-prefix (PR #106335)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 28 09:19:03 PDT 2024


================
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++20 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
+
+template <template <class> class S>
+void create_unique()
+  requires (S{0}, true) {}
+
+template <class Fn> struct A {
+  constexpr A(Fn) {};
+};
+
+template void create_unique<A>();
+// CHECK: @_Z13create_uniqueI1AEvvQcmtlT_Li0EELb1E(
----------------
mizvekov wrote:

The incorrect canonicalization leads us to miss redeclarations:

https://godbolt.org/z/cqsnqjEhT

The previous patch, combined with this patch, fixes that test case entirely.

Also, the tying of the name of the template parameter with the mangling is problematic, as we can reasonably assume we can rename template parameters without causing an ABI break, but not here.

Moreover, when there are multiple declarations, with different names for the template parameter, which name shall we pick? What about when these names differ across TUs?

Lastly, keeping the previous behavior under a different ABI flag seems problematic, as we would be also tying these bugs to the flag.

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


More information about the cfe-commits mailing list