problem with friend and namespaces

Anthony Desportes Anthony.Desportes@ms.alcatel.fr
Wed Jun 28 06:15:00 GMT 2000


Hello,

I have a problem compiling this code

------------------- the code ------------------
//
// File test.cpp
//
#include <iostream.h>

void f();

namespace NS
{
  class A
  {
  public:
    A()  {i=6; };
     friend void ::f();   // line 14
    void foo()
    {
      ::f();
    };

  private:
    int i;
  };

};

void f()
{
  NS::A a;
  cout << "f()" << a.i << endl;
};

void main()
{
  NS::A a;
   a.foo();
};

---------------------  end of code -----------------------

The GCC version  : 2.92.2 on Linux Mandrake 7.0
I tried compiling it with "g++ test.cpp" and got a "parse error before '(' "
on line 14.
Is there a problem with friend declarations inside namespaces or with the
support of the '::' operator ?

I didn't find anything on such a bug.

Thanks in advance.

--
___________________________________________________

Anthony DESPORTES
Alcatel - Corporate Research Center
Technologies for Networks and Systems
E-Mail : mailto:Anthony.Desportes@ms.alcatel.fr
___________________________________________________




More information about the Gcc-bugs mailing list