This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gcc bug
- To: meixner at rbg dot informatik dot tu-darmstadt dot de
- Subject: Re: gcc bug
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Fri, 7 Apr 2000 09:28:57 +0200
- CC: gcc-bugs at gcc dot gnu dot org
- References: <38ED8316.3C56CBE8@rbg.informatik.tu-darmstadt.de>
> 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