diff --git a/taichi/program/kernel.cpp b/taichi/program/kernel.cpp index 39c1fcb401154..5460b8480fbeb 100644 --- a/taichi/program/kernel.cpp +++ b/taichi/program/kernel.cpp @@ -30,8 +30,9 @@ Kernel::Kernel(Program &program, const std::function &func, const std::string &primal_name, AutodiffMode autodiff_mode) { + // due to #6362, we cannot write [func, this] { return func(this); } this->init( - program, [func, this] { return func(this); }, primal_name, autodiff_mode); + program, [&] { return func(this); }, primal_name, autodiff_mode); } Kernel::Kernel(Program &program,