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: gcc bug


> 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

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