Compound literals doesn't work

When I use compound literals like

#define VECTOR_ROOT_E131_DATA (uint8_t[]){0x00, 0x00, 0x00, 0x04}

I get following error message:

lib/sACN/src/sACNDefs.h:76:42: error: taking address of temporary array
   76 | #define VECTOR_ROOT_E131_DATA (uint8_t[]){0x00, 0x00, 0x00, 0x04}

The compound literals works fine when using code runner on macOS with clang.

It seems this is a GCC problem / bug.

1 Like
#define VECTOR_ROOT_E131_DATA (const uint8_t[]){0x00, 0x00, 0x00, 0x04}

This is necessary for GCC not for Clang

1 Like