public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58054] New: 11.3 Friends, example from standard not compiled
@ 2013-08-02  6:53 dushistov at mail dot ru
  2013-08-02  6:57 ` [Bug c++/58054] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dushistov at mail dot ru @ 2013-08-02  6:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58054
           Summary: 11.3 Friends, example from standard not compiled
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dushistov at mail dot ru

Here is example from standard (page 250-251),

class A {
  class B { };
  friend class X;
};

struct X : A::B { // OK: A::B accessible to friend
  A::B mx; // OK: A::B accessible to member of friend
  class Y {
    A::B my; // OK: A::B accessible to nested member of friend
  };
};


$ g++ -std=c++11 -Wall -c test_friend.cc 
test_friend.cc:2:9: error: 'class A::B' is private
   class B { };
         ^
test_friend.cc:6:15: error: within this context
 struct X : A::B { // OK: A::B accessible to friend
               ^
I suppose that lines marked as OK in C++11 standard should
not emit any errors.


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

* [Bug c++/58054] 11.3 Friends, example from standard not compiled
  2013-08-02  6:53 [Bug c++/58054] New: 11.3 Friends, example from standard not compiled dushistov at mail dot ru
@ 2013-08-02  6:57 ` pinskia at gcc dot gnu.org
  2013-08-02  7:04 ` dushistov at mail dot ru
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-08-02  6:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like they changed how base classes are handled in C++ for C++11.
98 says this:
[class.friend]/2 

"Also, because the base-clause of the friend class is not 
part of its member declarations, the base-clause of the friend class cannot 
access the names of the private and protected members from the class granting 
friendship."

Or is this just in a need for a defect report.


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

* [Bug c++/58054] 11.3 Friends, example from standard not compiled
  2013-08-02  6:53 [Bug c++/58054] New: 11.3 Friends, example from standard not compiled dushistov at mail dot ru
  2013-08-02  6:57 ` [Bug c++/58054] " pinskia at gcc dot gnu.org
@ 2013-08-02  7:04 ` dushistov at mail dot ru
  2013-08-02 18:42 ` dushistov at mail dot ru
  2013-08-05  4:13 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dushistov at mail dot ru @ 2013-08-02  7:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Evgeniy Dushistov <dushistov at mail dot ru> ---
Yes, for C++ 2003 this is invalid code(page 212):

class A {
class B { };
friend class X;
};
class X : A::B { // ill-formed: A::B cannot be accessed
// in the base-clause for X
A::B mx; // OK: A::B used to declare member of X
class Y : A::B { // OK: A::B used to declare member of X
A::B my; // ill-formed: A::B cannot be accessed
// to declare members of nested class of X
};
};

but for 2011 they looks like change behaviour.


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

* [Bug c++/58054] 11.3 Friends, example from standard not compiled
  2013-08-02  6:53 [Bug c++/58054] New: 11.3 Friends, example from standard not compiled dushistov at mail dot ru
  2013-08-02  6:57 ` [Bug c++/58054] " pinskia at gcc dot gnu.org
  2013-08-02  7:04 ` dushistov at mail dot ru
@ 2013-08-02 18:42 ` dushistov at mail dot ru
  2013-08-05  4:13 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dushistov at mail dot ru @ 2013-08-02 18:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Evgeniy Dushistov <dushistov at mail dot ru> ---
Here history of changes of C++ standard that related to this bug:

http://wg21.cmeerw.net/cwg/issue372


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

* [Bug c++/58054] 11.3 Friends, example from standard not compiled
  2013-08-02  6:53 [Bug c++/58054] New: 11.3 Friends, example from standard not compiled dushistov at mail dot ru
                   ` (2 preceding siblings ...)
  2013-08-02 18:42 ` dushistov at mail dot ru
@ 2013-08-05  4:13 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-08-05  4:13 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppluzhnikov at google dot com

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 58053 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2013-08-05  4:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-02  6:53 [Bug c++/58054] New: 11.3 Friends, example from standard not compiled dushistov at mail dot ru
2013-08-02  6:57 ` [Bug c++/58054] " pinskia at gcc dot gnu.org
2013-08-02  7:04 ` dushistov at mail dot ru
2013-08-02 18:42 ` dushistov at mail dot ru
2013-08-05  4:13 ` pinskia at gcc dot gnu.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).