[BUG]: `static_bounds` and `constant` can't take a floating point in C++17
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 486
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 295
Description
C++17 doesn't allow us to pass floating point types as NTTP, thus this example fails to compile ([link](https://godbolt.org/z/PzW6aYrv7)):
```cpp
#include
#include
int main()
{
[[maybe_unused]] cuda::__argument::__constant<1.f> constant{};
}
```
We could provide a solution that partially works in C++17 by splitting the argument type and values. That means that instead of:
```cpp
template struct constant;
```
we could do:
```cpp
template struct constant;
```
where `V` needn't to have the same type as `T`, thus the user could create a floating point constant from an integral value. For example:
```cpp
constant v;
```
This would also make the framework work for extended floating point types like `__half` of `__nv_bfloat16`
Contributor guide
Assessment
This issue has not been assessed yet.