https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67166
Bug ID: 67166 Summary: Inconsistency between static data members and static functions when using multiple inheritance Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: anders.granlund.0 at gmail dot com Target Milestone: --- Consider the following two programs: struct A { static const int x = 0; }; struct B : A { using A::x; }; struct C : B, A {}; int main() { C::x; } struct A { static void x() {} }; struct B : A { using A::x; }; struct C : B, A {}; int main() { C::x; } Compile them with the following command line: g++ prog.cc -std=c++14 -pedantic-errors GCC inconsistently accepts the first program, but rejects the second program with the following error: prog.cc: In function 'int main()': prog.cc:4:16: error: reference to 'x' is ambiguous int main() { C::x; } ^ prog.cc:1:26: note: candidates are: static void A::x() struct A { static void x() {} }; ^ prog.cc:1:26: note: static void A::x() I think GCC should consistently accept both programs just like clang does. This is because we have no ambiguity here in the name-lookup. There is only one entity with name x, the static member of A. I have tried this with gcc HEAD 6.0.0 20150808 here: http://melpon.org/wandbox/permlink/mbr1XEKQp7bF71iS http://melpon.org/wandbox/permlink/E5iKa6GfLG2q1m0o