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

mdblack98 at yahoo dot com changed:

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

--- Comment #2 from mdblack98 at yahoo dot com ---
So how does one get this to compile then..Can't seem to find any combination of
parentheses that works.  I'm converting an entry in the hamlib project to an
array and that's what is causing this problem with static initialization of the
array.

x3.c:10:26: error: braced-group within expression allowed only inside a
function
   FRQ_RNG_160m_REGION##r((m), (lp), (hp), (v), (a))
                          ^
x3.c:6:25: note: in definition of macro ‘FRQ_RNG_160m_REGION1’
             { 1810, 2, (md), (lp), (hp), (v), (a) }
                         ^~
x3.c:21:20: note: in expansion of macro ‘FRQ_RNG_HF’
 struct foo myfoo = FRQ_RNG_HF(1, MYLIST, 5,100,1,1);
                    ^~~~~~~~~~


#include <stdio.h>

#define MYLIST {1,2,3,4,5}

#define FRQ_RNG_160m_REGION1(md,lp,hp,v,a) \
            { 1810, 2, (md), (lp), (hp), (v), (a) }


#define FRQ_RNG_HF(r,m,lp,hp,v,a) \
  FRQ_RNG_160m_REGION##r((m), (lp), (hp), (v), (a))

struct foo {
  int i1;
  int i2[64];
  int i3;
  int i4;
  int i5;
  int i6;
};

struct foo myfoo = FRQ_RNG_HF(1, MYLIST, 5,100,1,1);

int
main()
{
  for(int i=0;i<5;++i) printf("kk %d,%d\n",i,myfoo.i2[i]);
  return 0;
}

Reply via email to