diff --git a/gcc/cp/typeck2.cc b/gcc/cp/typeck2.cc index ac0fefa24f2..9608bdccd8b 100644 --- a/gcc/cp/typeck2.cc +++ b/gcc/cp/typeck2.cc @@ -2378,7 +2378,7 @@ build_m_component_ref (tree datum, tree component, tsubst_flags_t complain) /* Build an expression for "object + offset" where offset is the value stored in the pointer-to-data-member. */ ptype = build_pointer_type (type); - datum = cp_convert (ptype, datum, complain); + datum = convert (ptype, datum); if (!processing_template_decl) datum = build2 (POINTER_PLUS_EXPR, ptype, datum, convert_to_ptrofftype (component)); diff --git a/gcc/testsuite/g++.dg/expr/ptrmem11.C b/gcc/testsuite/g++.dg/expr/ptrmem11.C new file mode 100644 index 00000000000..7100a2d034b --- /dev/null +++ b/gcc/testsuite/g++.dg/expr/ptrmem11.C @@ -0,0 +1,17 @@ +// PR c++/113599 +// { dg-do run } + +struct A { void *a; }; +struct B { void *b; }; +struct C : public B, public A { A c; }; +static C d; + +int +main () +{ + A C::*e = &C::c; + A *f = &(d.*e); + A *g = &d.c; + if (f != g) + __builtin_abort (); +}