This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/36163] Friend declaration confused by namespace/using



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]