From 82fee98f38d9e823b6be1a6b3fb4ca218359634a Mon Sep 17 00:00:00 2001 From: Yi Xu Date: Wed, 19 Oct 2022 11:10:37 +0800 Subject: [PATCH] [bug] Fix potential bug in #6362 (#6363) Issue: #6362 --- taichi/program/kernel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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,