This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/16889] [3.4/3.5 Regression] ambiguity is not detected


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]