Since std::move(defaultS)
deduces the argument type as S const&
and returns a typename std::remove_reference<S const&>::type&&
, i.e., a S const&&
I'd think the code is OK: you won't be able to move from the S const&&
as the object is const
.
It doesn't make much sense to take a S const&&
as argument, I'd think. When you want to take a S&&
as argument you would need to create an object, e.g. using
void foo(S&& value = S(defaultS)) { ... }