--- /dev/null
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+struct S {
+ static void foo (S);
+ void foo (this S); // { dg-warning "explicit object member function only available with" "" { target c++20_down } }
+ template <int N, typename T>
+ static void bar (S, T);
+ template <int N, typename T>
+ void bar (this S, T); // { dg-warning "explicit object member function only available with" "" { target c++20_down } }
+ static void baz (const S &);
+ void baz (this const S &); // { dg-warning "explicit object member function only available with" "" { target c++20_down } }
+};
+
+void
+S::foo (S)
+{
+}
+
+void
+S::foo (this S) // { dg-warning "explicit object member function only available with" "" { target c++20_down } }
+{
+}
+
+template <int N, typename T>
+void
+S::bar (S, T)
+{
+}
+
+template <int N, typename T>
+void
+S::bar (this S, T) // { dg-warning "explicit object member function only available with" "" { target c++20_down } }
+{
+}
+
+void
+S::baz (const S &)
+{
+}
+
+void
+S::baz (this const S &) // { dg-warning "explicit object member function only available with" "" { target c++20_down } }
+{
+}
+
+void
+qux (S *p)
+{
+ S::foo (*p);
+ p->foo ();
+ S::bar <5> (*p, 0);
+ p->bar <5> (0);
+}
+
+// { dg-final { scan-assembler "_ZN1S3fooES_" } }
+// { dg-final { scan-assembler "_ZNH1S3fooES_" } }
+// { dg-final { scan-assembler "_ZN1S3barILi5EiEEvS_T0_" } }
+// { dg-final { scan-assembler "_ZNH1S3barILi5EiEEvS_T0_" } }
+// { dg-final { scan-assembler "_ZN1S3bazERKS_" } }
+// { dg-final { scan-assembler "_ZNH1S3bazERKS_" } }
case DEMANGLE_COMPONENT_CONST_THIS: \
case DEMANGLE_COMPONENT_REFERENCE_THIS: \
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS: \
+ case DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION: \
case DEMANGLE_COMPONENT_TRANSACTION_SAFE: \
case DEMANGLE_COMPONENT_NOEXCEPT: \
case DEMANGLE_COMPONENT_THROW_SPEC
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
printf ("rvalue reference this\n");
break;
+ case DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION:
+ printf ("explicit object parameter\n");
+ break;
case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
printf ("transaction_safe this\n");
break;
/* <nested-name> ::= N [<CV-qualifiers>] [<ref-qualifier>] <prefix> <unqualified-name> E
::= N [<CV-qualifiers>] [<ref-qualifier>] <template-prefix> <template-args> E
+ ::= N H <prefix> <unqualified-name> E
+ ::= N H <template-prefix> <template-args> E
*/
static struct demangle_component *
if (! d_check_char (di, 'N'))
return NULL;
- pret = d_cv_qualifiers (di, &ret, 1);
- if (pret == NULL)
- return NULL;
+ if (d_peek_char (di) == 'H')
+ {
+ d_advance (di, 1);
+ di->expansion += sizeof "this";
+ pret = &ret;
+ rqual = d_make_comp (di, DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION,
+ NULL, NULL);
+ }
+ else
+ {
+ pret = d_cv_qualifiers (di, &ret, 1);
+ if (pret == NULL)
+ return NULL;
- /* Parse the ref-qualifier now and then attach it
- once we have something to attach it to. */
- rqual = d_ref_qualifier (di, NULL);
+ /* Parse the ref-qualifier now and then attach it
+ once we have something to attach it to. */
+ rqual = d_ref_qualifier (di, NULL);
+ }
*pret = d_prefix (di, 1);
if (*pret == NULL)
case DEMANGLE_COMPONENT_CONST_THIS:
case DEMANGLE_COMPONENT_REFERENCE_THIS:
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
+ case DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION:
case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
case DEMANGLE_COMPONENT_NOEXCEPT:
case DEMANGLE_COMPONENT_THROW_SPEC:
case DEMANGLE_COMPONENT_RVALUE_REFERENCE:
d_append_string (dpi, "&&");
return;
+ case DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION:
+ return;
case DEMANGLE_COMPONENT_COMPLEX:
d_append_string (dpi, " _Complex");
return;
{
int need_paren;
int need_space;
+ int xobj_memfn;
struct d_print_mod *p;
struct d_print_mod *hold_modifiers;
need_paren = 0;
need_space = 0;
+ xobj_memfn = 0;
for (p = mods; p != NULL; p = p->next)
{
if (p->printed)
need_space = 1;
need_paren = 1;
break;
- FNQUAL_COMPONENT_CASE:
+ case DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION:
+ xobj_memfn = 1;
break;
default:
break;
d_append_char (dpi, ')');
d_append_char (dpi, '(');
+ if (xobj_memfn)
+ d_append_string (dpi, "this ");
if (d_right (dc) != NULL)
d_print_comp (dpi, options, d_right (dc));