Bug 51584 - Erroneous compilation when deriving from an inaccessible friend class.
Summary: Erroneous compilation when deriving from an inaccessible friend class.
Status: RESOLVED DUPLICATE of bug 47346
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks: 59002
  Show dependency treegraph
 
Reported: 2011-12-16 18:21 UTC by Prasoon
Modified: 2019-01-24 09:44 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-01-24 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Prasoon 2011-12-16 18:21:57 UTC
struct A {
 private:         
     class face;
     friend class face; 
};

struct A::face {};    

template <typename _CharT>
struct C : public A::face
{};

int main()
{
  C<int> x;
}

gets compiled on g++ 4.6.1.

It shouldn't because

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

A::face is inaccessible at the point of derivation. Comeau issues an error message.
Comment 1 Andrew Pinski 2011-12-16 19:58:58 UTC
I think this is related to PR 47346.
Comment 2 Jonathan Wakely 2019-01-24 09:44:57 UTC
(In reply to Andrew Pinski from comment #1)
> I think this is related to PR 47346.

Yes, it has nothing to do with the friend declaration.

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