[clang] [clang] ODR hashes depth+index and not name of TemplateTypeParm (PR #144796)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 23 01:52:04 PDT 2025
================
@@ -5164,6 +5164,29 @@ namespace A {
A::X x;
#endif
+namespace TemplateDecltypeOperator {
+
+#if defined(FIRST) || defined(SECOND)
+template <class T6>
+T6 func();
+#endif
+
+#if defined(SECOND)
+template <class UnrelatedT>
+using UnrelatedAlias = decltype(func<UnrelatedT>())();
+#endif
+
+#if defined(FIRST) || defined(SECOND)
+class A {
----------------
ilya-biryukov wrote:
Could you add a comment to this test that points to this PR/GitHub issue and mentions that we need to make sure despite the fact that `decltype(e)` gets canonicalized to `decltype(e_0)` where `e_0` can potentially have different template parameter names. Therefore, we need to ensure their ODR hashes are the same across multiple modules?
It might prove helpful in the future if somebody decides to reassess the choices made here and choose different trade-offs.
https://github.com/llvm/llvm-project/pull/144796
More information about the cfe-commits
mailing list