bug or idiosyncrasy?

Ulrich Drepper drepper@gmail.com
Fri Aug 17 07:15:00 GMT 2012


Compiling the following code with D defined works.  Leave it out (and
remove the extra dimension which has no influence on the data layout
etc) and it compiles.  Is this correct?  Why wouldn't a simple use of
an array parameter be sufficient?



#ifdef D
#define XD [1]
#define XR [0]
#define XBB {
#define XBE }
#else
#define XD
#define XR
#define XBB
#define XBE
#endif

int aa XD[10] = { XBB 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 XBE };

int f(int arr XD[10])
{
  int s = 0;
  for (auto i : arr XR)
    s += i;
  return s;
}

int main()
{
  return f(aa);
}



More information about the Gcc mailing list