This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PING^3] Wconversion: fixes for C++ front-end
On 06 Feb 2007 18:46:44 -0600, Gabriel Dos Reis <gdr@cs.tamu.edu> wrote:
"Manuel López-Ibáñez" <lopezibanez@gmail.com> writes:
[...]
| So the basic differences are the call to fold_if_not_in_template and
| the use of LOOKUP_NO_CONVERSION when calling ocp_convert. I honestly
| cannot see how to relate cp_convert and convert.
In that case, there does not seem reason to believe that the chain you
introduced is correct. We must conservatitely regard it as incorrect
until proven otherwise. the conversion code in cp/ has proven to be
tricky and sources of bugs, hence the caution that must be exercise.
That is the reason for not using the return value of
convert_and_check. But, yes, it could be done better. Thanks for
helping me finding out a better solution.
I suspect the real understanding comes from looking at ocp_convert,
which tells you what it returns on the convtype flag.
Both cp_convert and convert call ocp_convert with convtype =
CONV_OLD_CONVERT. However, they use different flags as the third
argument for ocp_convert: LOOKUP_NORMAL versus (LOOKUP_NORMAL |
LOOKUP_NO_CONVERSION).
I could detect the case where one of the types is POINTER_TYPE_P, and
call cp_convert instead of convert_and_check. However, I don't know
how to solve the mismatch in the flags in the call to ocp_convert.
A different approach would be to have a cp_convert_and_check function
that uses cp_convert instead of convert. Perhaps that is the right
solution.
Please, let me know your opinion.
Cheers,
Manuel.