Is it a bug in Visual C++ 2010 or right behaviour?
template
T f(T const &r)
{
return r;
}
template
T f(T &&r)
Your fix doesn't solve the problem with static_assert firing though. The static_assert(false, ...) will still trigger for compilers that parse templates at definition time (most do).
They will see that any function template instantiation will be ill-formed, and the Standard allows them to issue an error for the template itself then, and most will do so.
For making this work you need to make the expression dependent so that the compiler doesn't know when it parses the template that it will always evaluate to false. For example
template struct false_ { static bool const value = false; };
template
T f(T &&r)
{
static_assert(false_::value, "no way"); //< line # 10
return r;
}