This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH: PR 11687


Mark Mitchell <mark@codesourcery.com> writes:

| This patch fixes another regression introduced by my static_cast
| rewrite.  C++ says that there exists a conversion from a derived class
| to an ambiguous class, but you aren't allowed to use it.  Who knew?

Hmm, I think the wording

	       /* [conv.ptr]
		  
	          An rvalue of type "pointer to cv D," where D is a
		  class type, can be converted to an rvalue of type
		  "pointer to cv B," where B is a base class (clause
		  _class.derived_) of D.  If B is an inaccessible
		  (clause _class.access_) or ambiguous
		  (_class.member.lookup_) base class of D, a program
		  that necessitates this conversion is ill-formed.  */

is meant to read "the conversion is defined everywhere except here and
there."  In other words, the "conversion" in the last sentence is
designating the cast-notation.  Did we parse C++ programs in their
generic forms, the issue would be crystal-clear :-/

it is like saying that the function-call is ill-formed in

   struct A { };
 
   struct B { };

   void f(A) { }

   int main() { B b; f(b); }

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]