https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61162

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #4)
> Note that it is also wrong in the initializer case.

Right, my patch fixes this too.


(In reply to Tom Tromey from comment #5)
> But, curiously, in this case it points to the RHS of the assignment

Yeah, this warning comes from a different spot than the previous ones.

> (I still tend to think the "=" is the best location):
> 
> extern void *alloc (void);
> 
> int *f (void) {
>   int *r = alloc ();
>   return r;
> }
> 
> barimba. gcc --syntax-only -Wc++-compat r.c
> r.c: In function ‘f’:
> r.c:4:12: warning: request for implicit conversion from ‘void *’ to ‘int *’
> not permitted in C++ [-Wc++-compat]
>    int *r = alloc ();
>             ^

I'd prefer the RHS location here; it's the RHS that's being converted.

Reply via email to