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]

problem with friend and namespaces



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
___________________________________________________



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