Nav*_*K N 9 c++ compiler-construction rvalue lvalue
我有以下代码
string three()
{
return "three";
}
void mutate(string& ref)
{
}
int main()
{
mutate(three());
return 0;
}
Run Code Online (Sandbox Code Playgroud)
你可以看到我正在传递three()到mutate方法.这段代码汇编得很好.我的理解是,临时工具不能分配给非const引用.如果是,该程序如何编译?
有什么想法吗?
编辑:
编译器尝试过:VS 2008和VS2010 Beta