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

Alejandro Colomar <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #5 from Alejandro Colomar <[email protected]> ---
Actually, double commas are more dangerous than single.  With single commas, if
at least one of the expressions is a void expression, it can't be accidentally
used as a parameter list.  However, if there are double commas, it can be used
as a parameter list with one parameter.


alx@devuan:~/tmp$ cat comma.c 
void f(...);

#define X(e)                           \
((                                     \
        (void)0,                       \
        (e)                            \
))

#define Y(e)                           \
(                                      \
        (void)0,                       \
        (e)                            \
)

int
main(void)
{
        f X(1);
        f Y(1);
}
alx@devuan:~/tmp$ gcc -Wall -Wextra comma.c 
comma.c: In function ‘main’:
comma.c:11:30: error: invalid use of void expression
   11 |         _Generic(e, default: (void)0), \
      |                              ^~~~~~~
comma.c:19:11: note: in expansion of macro ‘Y’
   19 |         f Y(1);
      |           ^

Reply via email to