Implicit Capture of 'This' via '[=]' is Deprecated

Error

Error C4855 implicit capture of 'this' via '[=]' is deprecated in '/std:c++20'

Cause

Lambdas change slighlty with the upgrade to c++20, which gets implemented in 5.3. This error happens when upgrading something from 5.2 to 5.3.

Fix

In 5.2, a lambda is defined like this:

auto TracePositive = [=]() -> FHitResult {};

But in 5.3, it needs to become this:

auto TracePositive = [=, this]() -> FHitResult {};

Last updated