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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-07-14
                 CC|                            |manu at gcc dot gnu.org
          Component|c                           |c++
     Ever confirmed|0                           |1

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #0)
> This is not really a C-specific bug but I wasn't sure
> where else to file it.

I would suggest file it against C++, just because there are more regular
contributors to C++ (Jason and Paolo) than to C (only Joseph and not nearly as
regular).

In C++, we get:

test.c:1:23: error: cannot convert ‘int*’ to ‘double*’ in return
 #define Nil ((int *) 0)
                       ^
test.c:5:10: note: in expansion of macro ‘Nil’
   return Nil;
          ^

It is strange that it points to the closing parenthesis.

> I think instead it would be better to emit the warning at the "final"
> location and then print the macro definition information as notes.

In this case yes, but this is not always the case: See PR5252. Perhaps this
should be configurable per diagnostic, with the most common case being the
default. The default of Clang is the opposite of GCC, for this very reason:

test.c:5:10: error: cannot initialize return object of type 'double *' with an
rvalue of type 'int *'
  return Nil;
         ^~~
test.c:1:13: note: expanded from macro 'Nil'
#define Nil ((int *) 0)
            ^~~~~~~~~~~

Reply via email to