This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/51584] New: Errorneous compilation when deriving from an inaccessible friend class.


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

             Bug #: 51584
           Summary: Errorneous compilation when deriving from an
                    inaccessible friend class.
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: prasoonsaurav.nit@gmail.com


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]