tomlplusplus
tomlplusplus copied to clipboard
Lambda function error using nvcc
Environment
toml++ version and/or commit hash:
toml++ v3.4.0
Compiler:
nvcc v12.1 and v11.6
C++ standard mode:
-std=c++20 and c++17
Target arch:
x86_64
Library configuration overrides:
None
Relevant compilation flags:
--extended-lambda -std=c++17 or c++20
Describe the bug
Does not compile with error:
toml.hpp: In lambda function:
toml.hpp:8127:123: error: ‘__T0’ was not declared in this scope; did you mean ‘__y0’?
8127 | if constexpr (impl::is_constructible_or_convertible<bool, return_type>)
| ^~~~
| __y0
Steps to reproduce (or a small repro code sample)
$cat main.cu
#include <cuda.h>
#include <cstdio>
#include "toml.hpp"
int main(int argc, char **argv) {
printf("hello world!\n");
return 0;
}
Additional information
Compile the above main.cu
file using nvcc --extended-lambda -std=c++17 main.cu
c++17 and c++20 both produces the same error, also with or without --extended-lambda
There is some documentation here: https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#extended-lambdas and: https://stackoverflow.com/questions/74349712/cuda-11-fails-to-compile-due-to-type-traits-in-standard-library-when-using-exten