This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36163] New: Friend declaration confused by namespace/using
- From: "igodard at pacbell dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 May 2008 21:29:45 -0000
- Subject: [Bug c++/36163] New: Friend declaration confused by namespace/using
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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