以下代码compiles fine with vc++ 19.00.23506 (标志:/Wall/WX/Za
)和 vc++ 19.10.25109.0(标志:/Wall/WX/Za/permissive-
,这可以在 http://webcompiler.cloudapp.net 中检查),但是 doesn't compile with clang 3.8.0 and g++ 6.3.0 (标志:-std=c++11 -Wall -Wextra -Werror -pedantic-errors
)。它是 vc++ 中的错误吗?标准是否禁止此类构造?
struct
{
}
foo()
{
return {};
}
int main()
{
}
最佳答案
MSVC 出现错误:
[dcl.fct]/9 Types shall not be defined in return or parameter types...
关于c++ - 匿名结构作为返回类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42888031/