This is the mail archive of the gcc-bugs@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]

Re: egcs-1.0.1 confused by explicit cast


>>>>> Richard Hadsell <hadsell@blueskystudios.com> writes:

> (a) I'm not using "static_cast<T>(e)".  I am using 5.4 -- "Explicit type
> conversion (cast notation)."

The semantics are the same.

> I think you have missed 5.4 paragraph 4 -- "Any type conversion not
> mentioned below and not explicitly defined by the user (_class.conv_) is
> ill-formed."

Sloppy wording; your conversion can be performed by static_cast, so it is
covered by that section.  The passage you quote is left over from the ARM,
and should have been removed when the new-style casts were added.

> (b) The statement "a = b;" works, and it requires an implicit
> conversion.  Since there are no standard conversions available, it must
> use a user-defined conversion.  Only one user-defined conversion is
> allowed, so it must be the conversion function.  There is no constructor
> that will make this conversion.

Agreed.

> (c) It makes no sense to say that "a = b;" does the right thing, but "a
> = (A) b;" can't figure out what to do.

Perhaps, but that's what the standard says.

> I can't believe that the standard has changed in something this basic.

Changes to the overloading rules have subtle side effects.  This is one of
them.  The overloading rules kept changing almost right up to the end.

> (d) There are a number of compilers that have no trouble with this --
> SGI's CC 7.1, both old and new compilers; KAI's KCC 3.2; gcc version
> 2.7.2.1; an old cfront CC on HP-UX.

g++ is the first compiler to implement the new overloading rules.  It is
unfortunate that the rules were changed without extensive testing, though I
tried to get various breakages fixed.

> Please take this seriously, so that I can take egcs seriously.

I'm taking this seriously, but I don't agree with you.  Take it to
comp.std.c++ if you like.

Jason


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