Topic: pointer to members conversion


Author: Alexander Krotoff <krotoff@such.srcc.msu.su>
Date: 1996/07/01
Raw View
Hello,

Section 4.11 (Pointer to member conversions) of Jan 96 WP says:
 If B is an inaccessible, ambiguous or virtual base class of D, a
 program that necessitates this conversion is ill-formed.

Is there any rationale for the third point ? As seems to me, conversion of
pointer to virtual base class member to pointer to derived class member
cannot be implemnted like it is described in ARM, but still it is possible
to implement.

--
Alexander N. Krotoff
Research Computer Center
Moscow State University
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: b91926@fsgi02.fnal.gov (David Sachs)
Date: 1996/07/04
Raw View
Alexander Krotoff <krotoff@such.srcc.msu.su> writes:

>Hello,

>Section 4.11 (Pointer to member conversions) of Jan 96 WP says:
> If B is an inaccessible, ambiguous or virtual base class of D, a
> program that necessitates this conversion is ill-formed.

>Is there any rationale for the third point ? As seems to me, conversion of
>pointer to virtual base class member to pointer to derived class member
>cannot be implemnted like it is described in ARM, but still it is possible
>to implement.

I suspect that some compiler vendor found some difficulty with
implementing pointers to members of a virtual base class, and
sneaked in this restriction.

Some current C++ compilers have had no trouble implementing such
pointers. Borland has supported this construct for years.

I did not notice a corresponding restriction on declarators - Would
someone correct me if there really is such as restriction - so it
is apparently still legal to write.

class A { public: int i; };

class B : virtual public A { };

int A::* pm1 = &A::i;   // clearly legal

int B::* pm2 = &B::i;  // apparently legal but some compilers
         // may not support

// The following construct is apparently what would be outlawed
int B::* pm3 = pm1;
--
** The Klingons' favorite food was named by the first earthling to see it **
David Sachs - Fermilab, MSSG MS369 - P. O. Box 500 - Batavia, IL 60510
Voice: 1 708 840 3942      Deparment Fax: 1 708 840 3785
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]