c++: Fix up build_m_component_ref [PR113599]