gcc bug
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Fri Apr 7 00:37:00 GMT 2000
> According to my understanding of the C++ standard, there is no ambiguity
> in the code above. Furthermore I have tested another compiler (Sun
> Workshop 5.0) and this compiler does not issue any errors.
Thanks for your bug report. This is not a bug in the compiler, but in
your code. Both operators
operator Z &() { return x; }
operator const Z &() { return x; }
are viable candidates, and they both have an identity conversion for
the parameter. According to 13.3.3/1, the conversion sequences for the
result are considered, which, again, are identity
conversions. According to 13.3.3/2, your program is ill-formed.
If you question this line of reasoning, please discuss it in one of
the public C++ fora first, eg. comp.lang.c++.moderated, or
comp.std.c++.
Regards,
Martin
More information about the Gcc-bugs
mailing list