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
内括号,对吗?
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
内括号,对吗?