This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16889] [3.4/3.5 Regression] ambiguity is not detected
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Aug 2004 20:31:23 -0000
- Subject: [Bug c++/16889] [3.4/3.5 Regression] ambiguity is not detected
- References: <20040805193001.16889.dvv@gcc.dvv.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2004-08-05 20:31 -------
This is the obvious minimal example:
----------------------------
struct B {
int f();
};
struct B1 : virtual B {};
struct B2 : B {};
struct BB : B1, B2 {};
int i = BB().f();
-------------------------------------
g/x> ~/bin/gcc-3.4*/bin/c++ -c x.cc
g/x> ~/bin/gcc-3.3/bin/c++ -c x.cc
x.cc:9: error: request for member `f' is ambiguous
x.cc:2: error: candidates are: int B::f()
x.cc:2: error: int B::f()
To my great surprise, the picture changes once one makes member function f() a
member _variable_:
---------------------------
struct B {
int i;
};
struct B1 : virtual B {};
struct B2 : B {};
struct BB : B1, B2 {};
int i = BB().i;
------------------------------------
In this case, gcc3.4 suddently does spit out an error message (though not a very
enlightening) whereas 3.3 shows the same message as before:
g/x> ~/bin/gcc-3.4*/bin/c++ -c x.cc
x.cc:9: error: `B' is an ambiguous base of `BB'
g/x> ~/bin/gcc-3.3/bin/c++ -c x.cc
x.cc:9: error: request for member `i' is ambiguous
x.cc:2: error: candidates are: int B::i
x.cc:2: error: int B::i
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16889