public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21971] New: class friend declaration doesn't allow use in class scope
@ 2005-06-09  0:16 jconner at apple dot com
  2005-06-09  0:19 ` [Bug c++/21971] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: jconner at apple dot com @ 2005-06-09  0:16 UTC (permalink / raw)
  To: gcc-bugs

The following code:

  class a {
    friend class b;
    b *pb;
  };

Produces an error message in the current mainline (4.1.0 development):

  bar.c:3: error: ISO C++ forbids declaration of 'b' with no type
  bar.c:3: error: expected ';' before '*' token

14882:2003, 11.4.7, indicates that this should be allowed:

  "A name nominated by a friend declaration shall be accessible in the scope of the class containing the 
friend declaration."

This is a regression from 4.0.

-- 
           Summary: class friend declaration doesn't allow use in class
                    scope
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jconner at apple dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/21971] class friend declaration doesn't allow use in class scope
  2005-06-09  0:16 [Bug c++/21971] New: class friend declaration doesn't allow use in class scope jconner at apple dot com
@ 2005-06-09  0:19 ` pinskia at gcc dot gnu dot org
  2005-06-09  0:26 ` pinskia at gcc dot gnu dot org
  2005-06-09 16:12 ` gcc-bugzilla at gcc dot gnu dot org
  2 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-09  0:19 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lerdsuwa at users dot
                   |                            |sourceforge dot net
           Keywords|                            |rejects-valid


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/21971] class friend declaration doesn't allow use in class scope
  2005-06-09  0:16 [Bug c++/21971] New: class friend declaration doesn't allow use in class scope jconner at apple dot com
  2005-06-09  0:19 ` [Bug c++/21971] " pinskia at gcc dot gnu dot org
@ 2005-06-09  0:26 ` pinskia at gcc dot gnu dot org
  2005-06-09 16:12 ` gcc-bugzilla at gcc dot gnu dot org
  2 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-09  0:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-09 00:26 -------
Comeau also rejects the code.

I think this is invalid but I will let Kriang comment on this.

-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/21971] class friend declaration doesn't allow use in class scope
  2005-06-09  0:16 [Bug c++/21971] New: class friend declaration doesn't allow use in class scope jconner at apple dot com
  2005-06-09  0:19 ` [Bug c++/21971] " pinskia at gcc dot gnu dot org
  2005-06-09  0:26 ` pinskia at gcc dot gnu dot org
@ 2005-06-09 16:12 ` gcc-bugzilla at gcc dot gnu dot org
  2 siblings, 0 replies; 5+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2005-06-09 16:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gcc-bugzilla at gcc dot gnu dot org  2005-06-09 16:11 -------
Subject:  class friend declaration doesn't allow use in class scope


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2005-06-09 13:58 -------
Not a bug.  The clause you referred to:

  "A name nominated by a friend declaration shall be accessible in the scope of 
  the class containing the friend declaration."

actually means that the following code is not allowed:

  class A { class B {}; };
  class C {
    friend class A::B; // Error - A::B is not accessible inside C
  };

For your case, look at 11.4 paragraph 9:

  "For a friend class declaration, if there is no prior declaration, the class
that is specified
  belongs to the innermost enclosing non-class scope, but if it is subsequently
referenced,
  its name is not found by name lookup until a matching declaration is provided
in the innermost
  enclosing nonclass scope."





-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/21971] class friend declaration doesn't allow use in class scope
       [not found] <bug-21971-10413@http.gcc.gnu.org/bugzilla/>
@ 2006-01-13 15:54 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-13 15:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-01-13 15:54 -------
*** Bug 25784 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |metcalf at lcs dot mit dot
                   |                            |edu


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-01-13 15:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-09  0:16 [Bug c++/21971] New: class friend declaration doesn't allow use in class scope jconner at apple dot com
2005-06-09  0:19 ` [Bug c++/21971] " pinskia at gcc dot gnu dot org
2005-06-09  0:26 ` pinskia at gcc dot gnu dot org
2005-06-09 16:12 ` gcc-bugzilla at gcc dot gnu dot org
     [not found] <bug-21971-10413@http.gcc.gnu.org/bugzilla/>
2006-01-13 15:54 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).