@@ -3921,6 +3921,7 @@ static void
write_template_param (const tree parm)
{
int parm_index;
+ int level;
MANGLE_TRACE_TREE ("template-parm", parm);
@@ -3930,10 +3931,12 @@ write_template_param (const tree parm)
case TEMPLATE_TEMPLATE_PARM:
case BOUND_TEMPLATE_TEMPLATE_PARM:
parm_index = TEMPLATE_TYPE_IDX (parm);
+ level = TEMPLATE_TYPE_LEVEL (parm);
break;
case TEMPLATE_PARM_INDEX:
parm_index = TEMPLATE_PARM_IDX (parm);
+ level = TEMPLATE_PARM_LEVEL (parm);
break;
default:
@@ -3941,6 +3944,16 @@ write_template_param (const tree parm)
}
write_char ('T');
+ if (level > 1)
+ {
+ if (abi_warn_or_compat_version_crosses (19))
+ G.need_abi_warning = 1;
+ if (abi_version_at_least (19))
+ {
+ write_char ('L');
+ write_compact_number (level - 1);
+ }
+ }
/* NUMBER as it appears in the mangling is (-1)-indexed, with the
earliest template param denoted by `_'. */
write_compact_number (parm_index);
new file mode 100644
@@ -0,0 +1,9 @@
+// PR c++/109422
+// { dg-do compile { target c++20 } }
+
+struct C {
+ template<typename T>
+ void f(decltype([](T, auto) { return 0; })) {}
+};
+void g() { C().f<int>({}); }
+// { dg-final { scan-assembler "_ZN1C1fIiEEvDTtlNS_UlT_TL0__E_EEE" } }
new file mode 100644
@@ -0,0 +1,10 @@
+// PR c++/109422
+// { dg-do compile { target c++20 } }
+// { dg-additional-options "-fabi-version=18" }
+
+struct C {
+ template<typename T>
+ void f(decltype([](T, auto) { return 0; })) {}
+};
+void g() { C().f<int>({}); }
+// { dg-final { scan-assembler "_ZN1C1fIiEEvDTtlNS_UlT_T_E_EEE" } }