public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112744] New: Nested name specifier wrongly produces ambiguity in accessing static field
@ 2023-11-28  9:01 fchelnokov at gmail dot com
  2023-11-28 19:22 ` [Bug c++/112744] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fchelnokov at gmail dot com @ 2023-11-28  9:01 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-11-30 21:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28  9:01 [Bug c++/112744] New: Nested name specifier wrongly produces ambiguity in accessing static field fchelnokov at gmail dot com
2023-11-28 19:22 ` [Bug c++/112744] " mpolacek at gcc dot gnu.org
2023-11-28 19:30 ` mpolacek at gcc dot gnu.org
2023-11-30 21:42 ` cvs-commit at gcc dot gnu.org
2023-11-30 21:44 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).