[Bug c++/46687] New: Class member lookup ambiguity w/ overloaded static members and using declarations
hstong at ca dot ibm.com
gcc-bugzilla@gcc.gnu.org
Sat Nov 27 21:26:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46687
Summary: Class member lookup ambiguity w/ overloaded static
members and using declarations
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: hstong@ca.ibm.com
In the test case below, there is a set of overloaded static member functions
foo() whose true declarations all come from struct A.
While lookup from C would find foo in both B1 and B2, B1::foo refers to the
same
set of entities as B2::foo. There should be no ambiguity; GCC reports
otherwise.
The overload candidates for foo should be unambiguously found on the call and
overload resolution should determine that foo(void) is being called.
I also find it odd that the candidates are listed three times.
### Self-contained source (dataa.cpp):
struct A {
static int foo();
static int foo(char);
};
struct B1 : A { using A::foo; };
struct B2 : A { using A::foo; };
struct C : B1, B2 { };
enum { X = sizeof C::foo() };
### Command to reproduce:
g++ -c dataa.cpp
### Compiler output:
dataa.cpp:11:19: error: reference to 'foo' is ambiguous
dataa.cpp:3:15: error: candidates are: static int A::foo(char)
dataa.cpp:2:15: error: static int A::foo()
dataa.cpp:2:15: error: static int A::foo()
dataa.cpp:3:15: error: static int A::foo(char)
dataa.cpp:2:15: error: static int A::foo()
dataa.cpp:3:15: error: static int A::foo(char)
### g++ -v output:
Using built-in specs.
Target: powerpc64-unknown-linux-gnu
Configured with: ../gcc-4.5.0/configure --prefix=/data/gcc
--program-suffix=-4.5.0 --disable-libssp --disable-libgcj
--enable-version-specific-runtime-libs --with-cpu=default32 --enable-secureplt
--with-long-double-128 --enable-shared --enable-__cxa_atexit
--enable-threads=posix --enable-languages=c,c++,fortran
Thread model: posix
GNU C++ (GCC) version 4.5.0 (powerpc64-unknown-linux-gnu)
More information about the Gcc-bugs
mailing list