Movatterモバイル変換


[0]ホーム

URL:


Issue 142 - WG21 CWG Issues
Title
Injection-related errors in access example
Status
tc1
Section
11.8.3 [class.access.base]
Submitter
Steve Adamczyk

Created on1999-07-16.00:00:00 last changed277 months ago

Messages

msg227 (view)
Date: 1999-10-15.00:00:00

Proposed resolution (10/00):

Replace the example in11.8.3 [class.access.base] paragraph 3with:

    class B {    public:        int mi;                 // nonstatic member        static int si;          // static member    };    class D: private B {    };    class DD: public D {        void f();    };    void DD::f() {        mi = 3;                 // error: mi is private in D        si = 3;                 // error: si is private in D        ::B b;        b.mi = 3;               // OK (b.mi is different from this->mi)        b.si = 3;               // OK (b.si is different from this->si)        ::B::si = 3;            // OK        ::B* bp1 = this;        // error: B is a private base class        ::B* bp2 = (::B*)this;  // OK with cast        bp2->mi = 3;            // OK: access through a pointer to B    }
msg143 (view)
Date: 2004-09-10.00:00:00

In the example in paragraph 3 of11.8.3 [class.access.base], all the referencestoB inDD::f() should be replaced by::B.The reason is that the class nameB is private inDand thus inaccessible inDD. (The example was probably notupdated when class name injection was added.)

History
DateUserActionArgs
2003-04-25 00:00:00adminsetstatus: dr -> tc1
2000-11-18 00:00:00adminsetstatus: ready -> dr
2000-05-21 00:00:00adminsetstatus: drafting -> ready
2000-02-23 00:00:00adminsetmessages: +msg227
2000-02-23 00:00:00adminsetstatus: open -> drafting
1999-07-16 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp