Hi.      
       
I'm writing a lookuptable container derived from 2 std::vectors (one public, 
one 
private).   
The issue I came across can be witnessed by trying to compile:       
      
[CODE]     
    
#include <iostream>      
#include <cstdlib>      
      
using namespace std;      
      
struct A      
{      
 int i;      
};      
      
struct B      
{      
 int i;      
};      
      
class C : public A, private B      
{      
};      
    
int main()      
{      
 C T;      
      
 cout << T.B::i;      
 cout << T.i;      
       
 return 0;      
}      
     
[/CODE]    
    
Compiler output:     
     
bugtest.cpp:24: error: request for member `i' is ambiguous     
bugtest.cpp:13: error: candidates are: int B::i     
bugtest.cpp:8: error: int A::i     
bugtest.cpp:25: error: `B' is an inaccessible base of `C'     
 
Huh? 
 
If this is not a bug (thanks to some efficient committee), there are 2 possible 
workarounds: 
1. compile code as is :-)

-- 
           Summary: Non-ambiguous member in multiple inheritance reported
                    ambiguous (All Versions)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hrbattenfeld at gmx dot de
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20556

Reply via email to