https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112744

            Bug ID: 112744
           Summary: Nested name specifier wrongly produces ambiguity in
                    accessing static field
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This program

struct A { constexpr static int a = 0; };
struct B : A {};
struct C : A {};
struct D : B, C {};

int main() {
    (void)D{}.a;   //ok everywhere
    (void)D{}.A::a; //error in GCC
}

is accepted in Clang and MSVC, but GCC fails on the line with nested name
specifier:

error: 'A' is an ambiguous base of 'D'

Online demo: https://godbolt.org/z/vY6rjd9fx

Reply via email to