diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDCommand.h b/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDCommand.h index 48ce6b9b53..d106ad348d 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDCommand.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/ProfiledPIDCommand.h @@ -97,7 +97,7 @@ class ProfiledPIDCommand std::initializer_list requirements) : ProfiledPIDCommand( controller, measurementSource, - [&goalSource]() { + [goalSource = std::move(goalSource)]() { return State{goalSource(), Velocity_t{0}}; }, useOutput, requirements) {} @@ -119,7 +119,7 @@ class ProfiledPIDCommand wpi::span requirements = {}) : ProfiledPIDCommand( controller, measurementSource, - [&goalSource]() { + [goalSource = std::move(goalSource)]() { return State{goalSource(), Velocity_t{0}}; }, useOutput, requirements) {}