[Bug c++/112744] New: Nested name specifier wrongly produces ambiguity in accessing static field
fchelnokov at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Nov 28 09:01:13 GMT 2023
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
More information about the Gcc-bugs
mailing list