[Bug c/89373] New: macro expansion not counting braces correctly
mdblack98 at yahoo dot com
gcc-bugzilla@gcc.gnu.org
Sat Feb 16 05:11:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89373
Bug ID: 89373
Summary: macro expansion not counting braces correctly
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: mdblack98 at yahoo dot com
Target Milestone: ---
include <stdio.h>
#define MYMACRO1(m) MYLIST;
#define MYMACRO(r,m) \
MYMACRO##r(m)
#define MYLIST {1,2,3,4,5}
// too many args -- does not allow for braces such as used for array
initialization
int ii[32] = MYMACRO(1,{1,2,3,4,5});
// too many args -- does not allow for braces such as used for array
initialization
int jj[32] = MYMACRO(1,MYLIST);
// this works
int kk[32] = MYLIST;
int
main()
{
// all 3 of these should print 1,2,3,4,5
for(int i=0;i<5;++i) printf("ii %d,%d\n",i,ii[i]);
for(int i=0;i<5;++i) printf("jj %d,%d\n",i,jj[i]);
for(int i=0;i<5;++i) printf("kk %d,%d\n",i,kk[i]);
return 0;
}
More information about the Gcc-bugs
mailing list