Open andresailer opened 3 hours ago
You need to use -std=c++20
if you want to use std::simd
. Are you using it? I've only ever tested with std::simd
from GCC, even with Clang. So, if you have a recipe which I can use to reproduce the issue, I can change things in VecCore before I tag the next release, which is coming quite soon.
It is just a flag that has to be exported like an LINK Option (?)INTERFACE_COMPILE_OPTION
Yes, I am using c++20 otherwise I wouldn't reach this code
Right?
Here is a simple reproducer, as long as you have a mac14 clang16 machine, I guess?
cat > test.cpp << EOF
#include <experimental/simd>
template <typename T, class Abi>
struct TypeTraits<std::experimental::simd_mask<T, Abi>> {
using IndexType = typename std::experimental::simd_mask<T, Abi>::simd_type;
using ScalarType = typename std::experimental::simd_mask<T, Abi>::value_type;
static constexpr size_t Size = std::experimental::simd<T, Abi>::size();
};
int main() {
return 0;
}
EOF
clang++ -std=c++20 test.cpp
clang++ -std=c++20 -fexperimental-library test.cpp
The reproducer above doesn't work.
test.cpp:3:8: error: explicit specialization of undeclared template struct 'TypeTraits'
I guess just #include <VecCore>
should do, though.
Please look at the difference between with and without -fexperimental-library
bash-3.2$ clang++ -fexperimental-library -std=c++20 test2.cpp
test2.cpp:3:8: error: explicit specialization of undeclared template struct 'TypeTraits'
3 | struct TypeTraits<std::experimental::simd_mask<T, Abi>> {
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
bash-3.2$ clang++ -std=c++20 test2.cpp
test2.cpp:3:24: error: no member named 'experimental' in namespace 'std'
3 | struct TypeTraits<std::experimental::simd_mask<T, Abi>> {
| ~~~~~^
test2.cpp:3:48: error: 'T' does not refer to a value
3 | struct TypeTraits<std::experimental::simd_mask<T, Abi>> {
| ^
test2.cpp:2:20: note: declared here
2 | template <typename T, class Abi>
| ^
test2.cpp:3:8: error: explicit specialization of undeclared template struct 'TypeTraits'
3 | struct TypeTraits<std::experimental::simd_mask<T, Abi>> {
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test2.cpp:3:55: error: expected unqualified-id
3 | struct TypeTraits<std::experimental::simd_mask<T, Abi>> {
| ^
4 errors generated.
gentoo ~ $ clang++ -std=c++20 test.cpp
test.cpp:3:8: error: explicit specialization of undeclared template struct 'TypeTraits'
3 | struct TypeTraits<std::experimental::simd_mask<T, Abi>> {
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
gentoo ~ $ clang++ -std=c++20 -fexperimental-library test.cpp
test.cpp:3:8: error: explicit specialization of undeclared template struct 'TypeTraits'
3 | struct TypeTraits<std::experimental::simd_mask<T, Abi>> {
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
clang++ --version
Apple clang version 16.0.0 (clang-1600.0.26.4)
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I will try on macOS, the above is on Linux, and with clang-18, so might explain the differences.
It might be easier if you give me access to one of your build nodes, I only have an old machine with macOS 11.7 available to me at the moment, and that has clang 13 installed.
As far as I can tell building against veccore on apple clang 16 on macos needs -fexperimental-library
Otherwise there is going to be a lot of