cuda-samples icon indicating copy to clipboard operation
cuda-samples copied to clipboard

c++20 Floating point template argument not working

Open Saitama10000 opened this issue 3 years ago • 0 comments

This code gives this error even though it works with the host compiler:

template <float h> void f() {}

int main()
{
    f<1.0f>();
}
nvcc main.cu

main.cu(1): error: floating-point template parameter is nonstandard

main.cu(5): error: expression must have integral or enum type
gcc (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.

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

Saitama10000 avatar Dec 16 '22 14:12 Saitama10000