[cfe-dev] Trying to work on "C++ Type-checking for copy assignment" project
Sebastian Redl
sebastian.redl at getdesigned.at
Sat May 16 10:05:39 PDT 2009
Vyacheslav Kononenko wrote:
> Hello,
> I am interested to provide some help to your project.
Great :-)
> So I made some
> changes for subj, as assignment resolution does not work corectly for
> C++. Work is not finished, but I want to check if I am on the right
> direction.
There may be a deeper issue here. Why is falling back to the built-in
assignment operator the wrong thing to do? Apparently it does something
that lets invalid cases pass. Why is that so?
> Please check attached patch for clang. I changed
> Sema::CreateOverloadedBinOp so it does not use built-in assignment
> operator in case left operand is a class instance but generates error
> err_ovl_no_viable_oper ("no viable overloaded '='") instead. Is it
> proper error message for this case?
>
This is a tricky issue. For some cases, "no viable overloaded '='" is
the better message (e.g. for the nb = constB testcase). For others,
especially when there are no user-defined assignment operators in the
target type, 'incompatible type' would be the better message.
What does it say for this:
int i = hasNoConversionToInt();
For this case, no viable overload would definitely be the wrong message.
Sebastian
More information about the cfe-dev
mailing list