@@ -4095,7 +4095,56 @@ d_print_comp (struct d_print_info *dpi, int options,
case DEMANGLE_COMPONENT_ARGLIST:
case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST:
if (d_left (dc) != NULL)
- d_print_comp (dpi, options, d_left (dc));
+ {
+ const struct demangle_component *left = d_left (dc);
+
+ if (dc->type == DEMANGLE_COMPONENT_TEMPLATE_ARGLIST
+ && left->type == DEMANGLE_COMPONENT_UNARY
+ && d_left (left)->type == DEMANGLE_COMPONENT_OPERATOR
+ && d_left (left)->u.s_operator.op->len == 1
+ && d_left (left)->u.s_operator.op->name[0] == '&'
+ && d_right (left)->type == DEMANGLE_COMPONENT_TYPED_NAME
+ && d_left (d_right (left))->type == DEMANGLE_COMPONENT_QUAL_NAME
+ && d_right (d_right (left))->type == DEMANGLE_COMPONENT_FUNCTION_TYPE)
+ {
+ /* Address of a function in template argument list must have its
+ argument list suppressed. The resolution is already not
+ ambiguous due to the function type expected by the template.
+
+ template argument list
+ unary operator ... left
+ operator & ... d_left (left)
+ typed name ... d_right (left)
+ qualified name ... d_left (d_right (left))
+ <names>
+ function type ... d_right (d_right (left))
+ argument list
+ <arguments> */
+
+ d_print_expr_op (dpi, options, d_left (left));
+ d_print_comp (dpi, options, d_left (d_right (left)));
+ }
+ else if (dc->type == DEMANGLE_COMPONENT_TEMPLATE_ARGLIST
+ && left->type == DEMANGLE_COMPONENT_UNARY
+ && d_left (left)->type == DEMANGLE_COMPONENT_OPERATOR
+ && d_left (left)->u.s_operator.op->len == 1
+ && d_left (left)->u.s_operator.op->name[0] == '&'
+ && d_right (left)->type == DEMANGLE_COMPONENT_QUAL_NAME)
+ {
+ /* Keep also already processed variant without the argument list.
+
+ template argument list
+ unary operator ... left
+ operator & ... d_left (left)
+ qualified name ... d_right (left)
+ <names> */
+
+ d_print_expr_op (dpi, options, d_left (left));
+ d_print_comp (dpi, options, d_right (left));
+ }
+ else
+ d_print_comp (dpi, options, left);
+ }
if (d_right (dc) != NULL)
{
size_t len;
@@ -3990,6 +3990,18 @@ outer(short (*)(int), long)
_Z6outer2IsEPFilES1_
outer2<short>(int (*)(long))
#
+--format=gnu-v3 --no-params
+_ZN1KIXadL_ZN1S1mEiEEE1fEv
+K<&S::m>::f()
+K<&S::m>::f
+--format=gnu-v3
+_ZN1KILi1EXadL_ZN1S1mEiEEE1fEv
+K<1, &S::m>::f()
+# Here the `(int)' argument list of `S::m' is already removed.
+--format=gnu-v3
+_ZN1KILi1EXadL_ZN1S1mEEEE1fEv
+K<1, &S::m>::f()
+#
# Ada (GNAT) tests.
#
# Simple test.