https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114525
--- Comment #5 from Simon Martin <simartin at gcc dot gnu.org> --- I'm back to this PR after a long while. I'm currently testing the following patch, that fixes the PR testcase diff --git a/gcc/cp/typeck2.cc b/gcc/cp/typeck2.cc index 1adc05aa86d..45edd180173 100644 --- a/gcc/cp/typeck2.cc +++ b/gcc/cp/typeck2.cc @@ -2387,7 +2387,7 @@ build_m_component_ref (tree datum, tree component, tsubst_flags_t complain) (cp_type_quals (type) | cp_type_quals (TREE_TYPE (datum)))); - datum = build_address (datum); + datum = cp_build_addr_expr (datum, complain); /* Convert object to the correct base. */ if (binfo)