On 11/19/18 2:23 PM, David Malcolm wrote:
[ Snip ]

> 
> The above code is in c-family, but same_type_p is specific to C++,
> so the change is not quite trivial.
> 
> Here's a v3 of the patch which moves same_type_p from cp/cp-tree.h
> to c-family/c-common.h, converting it from a macro to an extern decl,
> with implementations for C and for C++.  I used:
>   comptypes (type1, type2) == 1
> for the C implementation of same_type_p.
> 
> The v3 patch uses same_type_p rather than pointer equality, and I added
> a test case for a typedef of int vs a int.
> 
> Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
> 
> Is this OK for trunk?
> 
> Thanks
> Dave
> 
> gcc/c-family/ChangeLog:
>       PR c++/87850
>       * c-common.c: Include "gcc-rich-location.h".
>       (maybe_emit_indirection_note): New function.
>       * c-common.h (maybe_emit_indirection_note): New decl.
>       (same_type_p): New decl
> 
> gcc/c/ChangeLog:
>       PR c++/87850
>       * c-typeck.c (same_type_p): New function.
>       (convert_for_assignment): Call maybe_emit_indirection_note for
>       pointer vs non-pointer diagnostics.
> 
> gcc/cp/ChangeLog:
>       PR c++/87850
>       * call.c (convert_like_real): Call
>       maybe_emit_indirection_note for "invalid conversion" diagnostic.
>       * cp-tree.h (same_type_p): Delete macro, moving to...
>       * typeck.c (same_type_p): New function.
> 
> gcc/testsuite/ChangeLog:
>       PR c++/87850
>       * c-c++-common/indirection-fixits.c: New test.
OK.
jeff

Reply via email to