simde icon indicating copy to clipboard operation
simde copied to clipboard

"compound literals are a C99-specific feature" error with C++

Open dgazzoni opened this issue 2 years ago • 0 comments

When adding the arm/neon.h include to a C++, compiled with Apple clang 12 in macOS using the -pedantic flag, I get the following error:

In file included from /.../simde-no-tests/arm/neon.h:51:
/.../simde-no-tests/arm/neon/ceqz.h:203:49: error: compound literals are a C99-specific feature [-Werror,-Wc99-extensions]
    return simde_vceqq_f16(a, simde_vdupq_n_f16(SIMDE_FLOAT16_VALUE(0.0)));
                                                ^
/.../simde-no-tests/arm/neon/../../simde-f16.h:204:38: note: expanded from macro 'SIMDE_FLOAT16_VALUE'
  #define SIMDE_FLOAT16_VALUE(value) SIMDE_FLOAT16_C(value)
                                     ^
/.../simde-no-tests/arm/neon/../../simde-f16.h:89:35: note: expanded from macro 'SIMDE_FLOAT16_C'
  #define SIMDE_FLOAT16_C(value) ((simde_float16) { HEDLEY_STATIC_CAST(__fp16, (value)) })
                                  ^
1 error generated.

There is a second occurrence of the same error in the same file, which I have not reproduced here.

The error appears to be limited to these two points of this single file (for now). Could this be rewritten to avoid this error? Additionally, would it be interesting to add this scenario to the CI tests to prevent this error in the future?

dgazzoni avatar Sep 29 '21 19:09 dgazzoni