[omniORB] Re: Mapping problem?

David Riddoch djr@orl.co.uk
Mon, 23 Nov 1998 14:50:44 +0000 (GMT)


Gary,

You are correct that attempting to widen one _var type to a base _var type
must generate a compiler error. In fact on most compilers (and certainly
on SUN and egcs) it does.

The c++ language states that the compiler should only implicitly apply a
single conversion when attempting to find a match for an argument. In this
is example it is applying two -
      B_var::operator B* ()
      the conversion from B* to A*
Thus your compiler should have given a warning.

Your suggestion for changing the signature of the member assignment
operator also has a problem - it would require the compiler to create a
temporary variable for the argument under certain circumstances. This is
contrary to the c++ spec.

eg.

extern T* p();

void g()
{
  A_var av;

  av = p();  // Temporary required.
}


David