Hi,
I’m bumping my toolchain from CUDA 11.6 to 11.7 Update 1 on Ubuntu 20.04, and the following minimal reproducible example no longer compiles:
#include <type_traits>
template <typename Fn, typename ...Args>
using result_type = typename std::result_of<Fn(Args...)>;
template <typename Fn>
typename result_type<Fn, std::size_t>::type foo(Fn&& fn) {
return {};
}
int main()
{
foo([](std::size_t){return 123;});
}
$ /usr/local/cuda-11.7/bin/nvcc -std=c++14 test.cu
test.cu: In function ‘int main()’:
test.cu:14:37: error: no matching function for call to ‘foo(main()::<lambda(std::size_t)>)’
14 | foo([](std::size_t){return 123;});
| ^
test.cu:7:1: note: candidate: ‘template<class Fn> typename std::result_of<Fn(long unsigned int, ...)>::type foo(Fn&&)’
7 | typename result_type<Fn, std::size_t>::type foo(Fn&& fn) {
| ^~~
test.cu:7:1: note: template argument deduction/substitution failed:
test.cu: In substitution of ‘template<class Fn> typename std::result_of<Fn(long unsigned int, ...)>::type foo(Fn&&) [with Fn = main()::<lambda(std::size_t)>]’:
test.cu:14:37: required from here
test.cu:7:1: error: invalid use of incomplete type ‘class std::result_of<main()::<lambda(std::size_t)>(long unsigned int, ...)>’
/usr/include/c++/9/type_traits:2167:35: note: declaration of ‘class std::result_of<main()::<lambda(std::size_t)>(long unsigned int, ...)>’
2167 | template<typename _Signature>
| ^
It compiles fine on NVCC 11.6.
This type of code exists pervasively in the RapidCheck testing framework (host code).
Any ideas what could be going on? Thanks!