[Bug c++/60011] New: Compile error for legal exemplar from c++11 std [class.friend] 11.3.2

2014-01-31 Thread peter at hurleysoftware dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60011

Bug ID: 60011
   Summary: Compile error for legal exemplar from c++11 std
[class.friend] 11.3.2
   Product: gcc
   Version: 4.8.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: peter at hurleysoftware dot com

Created attachment 32003
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32003&action=edit
testcase

g++ 4.8.2 fails to compile the legal example from c++11 std specification,
section 11.3.2 [class.friend]:

"Declaring a class to be a friend implies that the names of private and
protected members from the class granting friendship can be accessed in the
base-specifiers and member declarations of the befriended class.
[ Example:

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
  };
};

—end example ]"

Note specifically that the private nested class A::B is a valid base specifier
for the friend class X. However, g++ 4.8.2 issues the following error
diagnostic when A::B is used as the base specifier:

peter@thor:~/src/test/c++$ /opt/gcc-4.8.2/bin/g++ -c -std=c++11 nested.cpp
nested.cpp:3:8: error: ‘class A::B’ is private
  class B {};
^
nested.cpp:7:15: error: within this context
 struct X : A::B {
   ^

[Bug c++/60011] Compile error for legal exemplar from c++11 std [class.friend] 11.3.2

2014-01-31 Thread peter at hurleysoftware dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60011

--- Comment #3 from Peter Hurley  ---
Sorry for the noise. I did search beforehand but neglected to also search
'resolved' bugs as well.


[Bug c++/60011] Compile error for legal exemplar from c++11 std [class.friend] 11.3.2

2014-01-31 Thread peter at hurleysoftware dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60011

Peter Hurley  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #4 from Peter Hurley  ---
Marking as duplicate of PR59482

*** This bug has been marked as a duplicate of bug 59482 ***


[Bug c++/59482] A friend class cannot inherit a private nested class

2014-01-31 Thread peter at hurleysoftware dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59482

Peter Hurley  changed:

   What|Removed |Added

 CC||peter at hurleysoftware dot com

--- Comment #4 from Peter Hurley  ---
*** Bug 60011 has been marked as a duplicate of this bug. ***