diff options
-rw-r--r-- | gcc/cp/typeck.cc | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/overload/using6.C | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc index 1b7a31d..5970ac3 100644 --- a/gcc/cp/typeck.cc +++ b/gcc/cp/typeck.cc @@ -3025,6 +3025,8 @@ build_class_member_access_expr (cp_expr object, tree member, know the type of the expression. Otherwise, we must wait until overload resolution has been performed. */ functions = BASELINK_FUNCTIONS (member); + if (TREE_CODE (functions) == OVERLOAD && OVL_SINGLE_P (functions)) + functions = OVL_FIRST (functions); if (TREE_CODE (functions) == FUNCTION_DECL && DECL_STATIC_FUNCTION_P (functions)) type = TREE_TYPE (functions); @@ -7333,6 +7335,9 @@ cp_build_addr_expr_1 (tree arg, bool strict_lvalue, tsubst_flags_t complain) { tree fn = BASELINK_FUNCTIONS (TREE_OPERAND (arg, 1)); + if (TREE_CODE (fn) == OVERLOAD && OVL_SINGLE_P (fn)) + fn = OVL_FIRST (fn); + /* We can only get here with a single static member function. */ gcc_assert (TREE_CODE (fn) == FUNCTION_DECL diff --git a/gcc/testsuite/g++.dg/overload/using6.C b/gcc/testsuite/g++.dg/overload/using6.C new file mode 100644 index 0000000..4f89f68 --- /dev/null +++ b/gcc/testsuite/g++.dg/overload/using6.C @@ -0,0 +1,5 @@ +// PR c++/109958 + +struct B { static int f(); }; +struct D : B { using B::f; }; +void f(D d) { &d.f; } |