Using user-defined literal in C++20 form results in next error:
❯ cat main.cu
template <std::size_t N> struct fixed_string {
constexpr fixed_string(const char *) {
}
};
template <fixed_string Str> constexpr auto operator""_a();
int main ()
{
return 0;
}
❯ nvcc --std=c++20 main.cu
main.cu(6): error: a literal operator template must have a template parameter list equivalent to "<char ...>"
1 error detected in the compilation of "main.cu".
❯ ln -s main.cu main.cpp
❯ g++ --std=c++20 main.cpp
❯ echo $?
0
❯ clang++ --std=c++20 main.cpp
❯ echo $?
0
While g++ and clang++ succeeds.
Same problem occurs compiling spdlog/fmtlib (1.11.0 / 9.1.0) in .cu files.
Compiler info
❯ g++ --version
g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
❯ clang++ --version
Ubuntu clang version 14.0.0-1ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
❯ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Mon_Oct_24_19:12:58_PDT_2022
Cuda compilation tools, release 12.0, V12.0.76
Build cuda_12.0.r12.0/compiler.31968024_0