egcs-1.0.1 confused by explicit cast
Jason Merrill
jason@cygnus.com
Mon Jan 26 10:36:00 GMT 1998
>>>>> Richard Hadsell <hadsell@blueskystudios.com> writes:
> Jason Merrill wrote:
>>
>> The problem is that an explicit cast is treated as an explicit constructor
>> call, not a conversion. g++ is correct.
> Sorry, I can't accept that. Please confirm your interpretation with the
> standard.
5.2.9 Static cast [expr.static.cast]
2 An expression e can be explicitly converted to a type T using a
static_cast of the form static_cast<T>(e) if the declaration T t(e);"
is well-formed, for some invented temporary variable t (_dcl.init_).
The effect of such an explicit conversion is the same as performing
the declaration and initialization and then using the temporary vari-
able as the result of the conversion.
Since the above declaration is a direct-initialization, and so the
candidates are the constructors of T, the same is true of a cast. The cast
notation does not have different semantics.
Jason
More information about the Gcc-bugs
mailing list