This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] v4: C/C++: add fix-it hints for missing '&' and '*' (PR c++/87850)
- From: Jason Merrill <jason at redhat dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: David Malcolm <dmalcolm at redhat dot com>, Jeff Law <law at redhat dot com>, Martin Sebor <msebor at gmail dot com>, Eric Gallager <egall at gwmail dot gwu dot edu>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 5 Dec 2018 11:03:26 -0500
- Subject: Re: [PATCH] v4: C/C++: add fix-it hints for missing '&' and '*' (PR c++/87850)
- References: <alpine.DEB.2.21.1811202222180.5991@digraph.polyomino.org.uk> <1543621685-20785-1-git-send-email-dmalcolm@redhat.com> <bfd109f7-fd46-2e18-c6d7-179f4907af61@redhat.com> <alpine.DEB.2.21.1812032213000.3293@digraph.polyomino.org.uk>
On Mon, Dec 3, 2018 at 5:14 PM Joseph Myers <joseph@codesourcery.com> wrote:
>
> On Sat, 1 Dec 2018, Jason Merrill wrote:
>
> > Hmm, it looks like the C front-end comptypes will return 1 for e.g. enum and
> > int. It seems to me that what you want for this warning is actually to check
> > for the same type. Perhaps you want to use comptypes_check_different_types?
> > Joseph would know better what's correct for the C front-end.
>
> Well, it's valid to pass a pointer to enum where a pointer to the
> compatible integer type is required, or vice versa, but I don't have
> advice on which cases you want to accept for this particular fix-it.
Since the diagnostic is about returning, e.g. an int when an int* is
needed, or vice versa, I don't think considering that kind of
conversion is helpful.
Jason