This code:

namespace   name {
    class foo {
    public:
        template<class T>
        void    baz(T& t) { int i = t.dat; }
        };
    }
using namespace name;
class bar {
friend class  foo;
    int dat;
    };
int main() {
    bar b;
    foo f;
    f.baz(b);
    }

gets you:
~/ootbc/members$ g++ foo.cc
foo.cc: In member function 'void name::foo::baz(T&) [with T = bar]':
foo.cc:16:   instantiated from here
foo.cc:11: error: 'int bar::dat' is private
foo.cc:5: error: within this context


-- 
           Summary: Friend declaration confused by namespace/using
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net


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

Reply via email to