boost-ext / di

C++14 Dependency Injection Library
https://boost-ext.github.io/di
1.16k stars 140 forks source link

BUG: Misuse of std::forward #394

Open Phygon opened 5 years ago

Phygon commented 5 years ago

https://github.com/boost-experimental/di/blob/19c30d5f5bc9946d7684457772fc3aa8b3bd43ef/extension/include/boost/di/extension/injections/factory.hpp#L35

std::forward is misused here, because TArgs&& is not a template argument of the create() function. That means, TArgs&& (all arguments in the parameter pack) are rvalue references, and reference collapsing cannot occur as intended.