12
decltype(auto) func(int&& n)
{
    return (n);
}

clang 12.0.1接受此代码,但gcc 11.2.1拒绝它:

error: cannot bind rvalue reference of type 'int&&' to lvalue of type 'int' 

gcc似乎使用 return type int &&,但带有n内括号,对吗?

神栓演示

4

0 回答 0