[Bug c++/3332] friend function declaration in a class in a namespace causes error

2004-11-25 Thread cvs-commit at gcc dot gnu dot org

--- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-11-25 
17:05 ---
Subject: Bug 3332

CVSROOT:/cvs/gcc
Module name:gcc
Changes by: [EMAIL PROTECTED]   2004-11-25 17:05:38

Modified files:
gcc/cp : ChangeLog name-lookup.c name-lookup.h parser.c 
gcc/testsuite  : ChangeLog 
Added files:
gcc/testsuite/g++.dg/lookup: friend3.C friend4.C friend5.C 

Log message:
Friend class name lookup 3/n, PR c++/3332
* name-lookup.c (push_inner_scope, pop_inner_scope): New functions.
(lookup_type_scope): Don't deal with name from user declaration
specially.
* name-lookup.h (push_inner_scope, pop_inner_scope): Add declarations.
* parser.c (cp_parser_class_specifier): Use push_inner_scope and
pop_inner_scope.

* g++.dg/lookup/friend3.C: New test.
* g++.dg/lookup/friend4.C: Likewise.
* g++.dg/lookup/friend5.C: Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gccr1=1.4497r2=1.4498
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gccr1=1.94r2=1.95
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.h.diff?cvsroot=gccr1=1.31r2=1.32
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gccr1=1.282r2=1.283
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gccr1=1.4647r2=1.4648
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/friend3.C.diff?cvsroot=gccr1=NONEr2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/friend4.C.diff?cvsroot=gccr1=NONEr2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/friend5.C.diff?cvsroot=gccr1=NONEr2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3332


[Bug c++/3332] friend function declaration in a class in a namespace causes error

2004-11-25 Thread lerdsuwa at gcc dot gnu dot org


-- 
   What|Removed |Added

   Target Milestone|--- |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3332


[Bug c++/3332] friend function declaration in a class in a namespace causes error

2004-11-25 Thread lerdsuwa at gcc dot gnu dot org

--- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-11-25 
17:06 ---
Fixed in the mainline by revised patch:
  http://gcc.gnu.org/ml/gcc-patches/2004-11/msg02149.html

-- 
   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3332


[Bug c++/3332] friend function declaration in a class in a namespace causes error

2004-11-18 Thread lerdsuwa at gcc dot gnu dot org

--- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-11-18 
17:04 ---
Patch submitted (both are required):

  (Friend lookup part 2/n) 
http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01372.html
  (Friend lookup part 3/n) 
http://gcc.gnu.org/ml/gcc-patches/2004-11/msg01495.html

-- 
   What|Removed |Added

   Keywords||patch


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3332


[Bug c++/3332] friend function declaration in a class in a namespace causes error

2004-11-11 Thread lerdsuwa at gcc dot gnu dot org

--- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-11-11 
12:37 ---
Taking this bug.  The code

  void N::func(void)

is rejected because the declaration

  friend void func(void);

doesn't declare 'func' inside namespace 'N'.
A separate declaration is necessary before the
qualified ID form 'N::func' can be used.  The 
following code, compiles under como, confirmed
the above idea.

namespace N
{
  class A;
}

class N::A
{
  void x();
  friend void func(void);
};

namespace N
{
  void func(void); // declare func
}

void N::func(void) // after declaration
   // can now defined using qualified name
{
  N::A a;
  a.x();  // access private function
}

int main()
{
  return 0;
}

The bug will be fixed when problematic codes in libjava
(it assumes friends are in '::') are corrected.


-- 
   What|Removed |Added

 AssignedTo|nathan at gcc dot gnu dot   |lerdsuwa at gcc dot gnu dot
   |org |org
 Status|SUSPENDED   |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3332