@@ -105,6 +105,14 @@ lvalue_kind (const_tree ref)
return op1_lvalue_kind;
case COMPONENT_REF:
+ if (BASELINK_P (TREE_OPERAND (ref, 1)))
+ {
+ tree fn = OVL_CURRENT (BASELINK_FUNCTIONS (TREE_OPERAND (ref, 1)));
+
+ /* For static member function recurse on the BASELINK. */
+ if (TREE_CODE (fn) == FUNCTION_DECL && DECL_STATIC_FUNCTION_P (fn))
+ return lvalue_kind (TREE_OPERAND (ref, 1));
+ }
op1_lvalue_kind = lvalue_kind (TREE_OPERAND (ref, 0));
/* Look at the member designator. */
if (!op1_lvalue_kind)
@@ -0,0 +1,13 @@
+// PR c++/80176
+// { dg-do compile }
+
+struct X { static void foo(); static void baz(int); static int baz(double); } x;
+void X::foo() {}
+static void bar() {}
+void (&r1)() = x.foo;
+void (&r2)() = X::foo;
+void (&r3)() = bar;
+void (&r4)(int) = x.baz;
+int (&r5)(double) = x.baz;
+void (&r6)(int) = X::baz;
+int (&r7)(double) = X::baz;