https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61165
Bug ID: 61165
Summary: unfriendly diagnostic from macro expansion
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: tromey at gcc dot gnu.org
Consider this source:
extern void *allocate (int);
#define my_alloc(X) allocate (X)
int *alloc_int(void)
{
int *result = my_alloc(sizeof (int));
return result;
}
Now compile with -Wc++-compat:
barimba. gcc --syntax-only -Wc++-compat r.c
r.c: In function ‘alloc_int’:
r.c:3:21: warning: request for implicit conversion from ‘void *’ to ‘int *’ not
permitted in C++ [-Wc++-compat]
#define my_alloc(X) allocate (X)
^
r.c:7:17: note: in expansion of macro ‘my_alloc’
int *result = my_alloc(sizeof (int));
^
I find this a bit strange. The actual "warning:" line points to
the #define -- but here I think I would have expected this to
point to the call instead, with a "note:" pointing to the macro
definition.