DLTcollab/sse2neon

error: initializer element is not constant

berolinux opened this issue · 2 comments

Trying to use sse2neon.h (current git master) results in

sse2neon.h: In function '_mm_addsub_pd':
sse2neon.h:6439:33: error: initializer element is not constant
 6439 |     static const __m128d mask = _mm_set_pd(1.0f, -1.0f);
      |                                 ^~~~~~~~~~
sse2neon.h: In function '_mm_addsub_ps':
sse2neon.h:6455:32: error: initializer element is not constant
 6455 |     static const __m128 mask = _mm_setr_ps(-1.0f, 1.0f, -1.0f, 1.0f);
      |                                ^~~~~~~~~~~

when using gcc 11.2 or

sse2neon.h:6439:33: error: initializer element is not a compile-time constant
    static const __m128d mask = _mm_set_pd(1.0f, -1.0f);
                                ^~~~~~~~~~~~~~~~~~~~~~~
sse2neon.h:6455:32: error: initializer element is not a compile-time constant
    static const __m128 mask = _mm_setr_ps(-1.0f, 1.0f, -1.0f, 1.0f);
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

when using clang 13.0

In both cases, the problem goes away when removing the static keyword, but of course that comes with a performance penalty.

Duplicate of #505 with a different description