This code:

struct B1 {
    void f(int*);
};

struct B2 {
    void f(double*);
};

struct D: B1, B2 {
private:
    using B1::f;
    using B2::f;
};

template <typename T>
  struct B
{
public:
    void f(T arg);
};


template <typename T, typename U>
  struct DD: B<T>, B<U>
{
private:
    using B<T>::f;
    using B<U>::f;
};

int main()
{
    D d;
    d.f((int*)0);
    DD<int*, double*> dd;
    dd.f((int*)0);
}  

Has the following error when compiling:

$ g++-4.3 -pedantic-errors -Wall -Wextra usingdecl.cpp
usingdecl.cpp: In function ‘int main()’:
usingdecl.cpp:2: error: ‘void B1::f(int*)’ is inaccessible
usingdecl.cpp:34: error: within this context

I thing there should be the same error line 36 (for the call to dd.f).

About versions: g++ 3.3 doesn't give any error.  3.4 and 4.0 gives both.  The
reported state is the behaviour since 4.1.


-- 
           Summary: using declaration doesn't control accessibility in
                    template
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jm at bourguet dot org


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

Reply via email to