This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36163] Friend declaration confused by namespace/using
- From: "mdjones0978-gccbugs at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Oct 2009 02:48:46 -0000
- Subject: [Bug c++/36163] Friend declaration confused by namespace/using
- References: <bug-36163-6594@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from mdjones0978-gccbugs at yahoo dot com 2009-10-30 02:48 -------
I think it is a bug, because the class test is declared at the scope :: (before
the namespace), then used below. The solution is to explicitly state the fact
it is from ::
#include <assert.h>
class Test;
namespace Boo {
class Outer {
friend class Test; // replace with ::Test to fix
private:
int _o;
class Inner {
friend class Test; // replace with ::Test to fix
int _i;
};
};
}
class Test {
public:
void DoTest() {
Boo::Outer::Inner oi;
assert(oi._i == 3);
}
};
main(int argc, char *argv[]) {
Test x;
x.DoTest();
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36163