Unlike isa<> and cast<>, current implementation of dyn_cast<> fails
to process a std::unique_ptr to a class supporting LLVM RTTI:
// A and B support LLVM RTTI
class A {...}
class B: public A {...}
void foo() {
...
auto V = std::make_unique<A>(); auto VB = dyn_cast<B>(std::move(V)); if (VB) ...
...
}
I think you want std::forward<std::unique_ptr<From>>(f)? - see here:
https://en.cppreference.com/w/cpp/utility/forward