static member function erroneously thought to be ambiguous...
Scott Collins
scc@netscape.com
Fri Apr 23 12:09:00 GMT 1999
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
...when the class that defines the static function appears multiple
times as a base class of the caller. I seem to be unable to attach a
file and still have the message delivered, so please find the test
case below.
I am using egcs-2.90.29 980515 (egcs-1.0.3 release).
Couldn't find mention of this bug on the website. So it may be a bug
in the latest release (which is why I'm reporting it). I'll test it
with the latest release at my earliest opportunity.
...begin test case...
// demonstration of a bug in egcs where static methods are considered
ambiguous
// when the class that defines them appears as a base multiple times
in the callers class
class base
{
public:
static int a_static_method() { return 3; }
// should be accessible to anyone as |base::a_static_method()|
};
int
non_member_test()
{
return base::a_static_method();
// Legal
}
class not_derived
{
public:
int
test_method()
{
return base::a_static_method();
// Legal
}
};
class X : public base { };
class Y : public base { };
class derived : public X, public Y
{
public:
int
test_method()
{
return base::a_static_method();
// Legal and unambiguous (only because it's static), but
// erroneously flagged as ambiguous by egcs
// test.cpp: In method `int derived::test_method()':
// test.cpp:42: type `base' is ambiguous baseclass of `derived'
}
};
...end test case...
Hope this helps,
______________________________________________________________________
Scott Collins < http://www.meer.net/ScottCollins?Netscape >
-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.0.2
Comment: get my key at < http://www.meer.net/ScottCollins/#key >
iQA/AwUBNyDFN/GmojMuVn+fEQJBXwCg8z6sBNeatV46hVLiDeHJEOwtI68AoIbY
RYgNnxpv1bbdI7fDDmlPsBDm
=4Y/A
-----END PGP SIGNATURE-----
test.cpp
More information about the Gcc-bugs
mailing list