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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to