hiredis icon indicating copy to clipboard operation
hiredis copied to clipboard

mmintrin.h: error: cannot initialize a parameter ...

Open Danvil opened this issue 2 years ago • 1 comments

Hello,

I have a simple C++ program which includes hiredis.h header and then C++ <future> header:

#include "hiredis.h"
#include <future>

When I compile under windows with LLVM clang-cl.exe I get the following compiler errors:

In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\future:25:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\ppltasks.h:27:
In file included from C:\Program Files\LLVM\lib\clang\11.0.0\include\intrin.h:20:
In file included from C:\Program Files\LLVM\lib\clang\11.0.0\include\x86intrin.h:15:
In file included from C:\Program Files\LLVM\lib\clang\11.0.0\include\immintrin.h:15:
C:\Program Files\LLVM\lib\clang\11.0.0\include\mmintrin.h(67,40): error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si' (aka 'int')
    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
                                       ^~~~~~~~~~~
C:\Program Files\LLVM\lib\clang\11.0.0\include\mmintrin.h(129,43): error: cannot initialize a parameter of type '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type '__v4hi' (aka 'short')
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                                          ^~~~~~~~~~~~
 an rvalue of type '__v2si' (aka 'int')
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                                          ^~~~~~~~~~~~
C:\Program Files\LLVM\lib\clang\11.0.0\include\mmintrin.h(189,43): error: cannot initialize a parameter of type '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type '__v4hi' (aka 'short')
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                                          ^~~~~~~~~~~~
...

Interestingly enough if I first include <future> and then hiredis.h it compiles fine.

Danvil avatar Jan 22 '22 01:01 Danvil

This looks like the same issue as in KjellKod/g3log/issues/282.

hiredis have a disabling of __attribute__(x) in sds.h for MS C/C++ compilers, which seems needed by <future>.

bjosv avatar Jan 27 '22 08:01 bjosv

@Danvil feel free to reopen if #1115 didn't fix the issue.

michael-grunder avatar Sep 15 '22 02:09 michael-grunder