[LLVMbugs] [Bug 16774] New: ISO/IEC 14882:2003 11.4 Friends, bad example compiled

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 2 00:26:16 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16774

            Bug ID: 16774
           Summary: ISO/IEC 14882:2003 11.4 Friends, bad example compiled
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dushistov at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Here is example from page 212 of c++ 2003 standard:
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
};
};

$ clang++ -c -std=c++03 test_friend_2003.cc

not emit any errors, while it should at line:
class X : A::B { // ill-formed: A::B cannot be accessed


GCC not compile such test:

$ g++ -c -std=c++03 test_friend_2003.cc
test_friend_2003.cc:2:7: error: 'class A::B' is private
 class B { };
       ^
test_friend_2003.cc:5:14: error: within this context
 class X : A::B { // ill-formed: A::B cannot be accessed

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130802/ffb80f31/attachment.html>


More information about the llvm-bugs mailing list