[LLVMbugs] [Bug 16228] New: clang does not implement DR472

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 4 15:29:00 PDT 2013


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

            Bug ID: 16228
           Summary: clang does not implement DR472
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Per http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#472 we should
not allow the following code:

    class B {
    public:
      int m;
    };

    class S: private B {
      friend class N;
    };
    class N: private S {
      void f() {
        B* p = this;    // OK because class S satisfies the fourth condition
                        // above: B is a base class of N accessible in f()
because
                        // B is an accessible base class of S and S is an
accessible
                        // base class of N.
      }
    };

    class N2: protected B { };

    class P2: public N2 {
      void f2(N2* n2p) {
        B* bp = n2p;    // error: invented member would be protected and naming
                        // class N2 not the same as or derived from the
referencing
                        // class P2
        n2p->m = 0;     // error (cf 11.4 [class.protected]) for the same
reason
      }
    };

GCC correctly raises a diagnostic.

-- 
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/20130604/b8a42259/attachment.html>


More information about the llvm-bugs mailing list