private typedef visible

Pierre Aubert paubert@pcmath03.insa-lyon.fr
Wed Dec 16 06:01:00 GMT 1998


//                                                          -*- c++ -*- 
// BUG REPORT
// ----------
// 
// Wed Dec 16 14:58:38 MET 1998 
// 
// gcc version egcs-2.92.29 19981215 on linux PII Debian 2.1 slink
// 
// Problem: the typedef in class B is private and should not be visible
// in class C 
// 
// ----------------------------------------------------------------------

template<class T>
class A
{
public:    
    typedef T value_t;
    T get() const {return T(0);}
};

template<class T>
class B
{
private:    
    typedef T value_t;
public:
    T get() const {return T(0);}
};

template<class Expr>
class C
{
public:
    typedef typename Expr::value_t value_t;
    value_t get() const {return value_t(0);}
};

int main()
{
    C<A<int> > ca;
    C<B<int> > cb;

    return ca.get()+cb.get();
}



More information about the Gcc-bugs mailing list