https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112744
Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2023-11-28 CC| |mpolacek at gcc dot gnu.org --- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Confirmed, I think. Since a is static, there is only one copy. So it should not matter that A is an ambiguous base of D (which it is). See [class]/note-3. For the error line, in finish_class_member_access_expr scope will be A, so we do 3496 /* Find the base of OBJECT_TYPE corresponding to SCOPE. */ 3497 access_path = lookup_base (object_type, scope, ba_check, 3498 NULL, complain); where object_type=D, scope=A. But the ba_check means we give an error. We don't know at this point that name refers to a static data member. But we can look it up, and maybe use ba_any. Not a regression.