编译器错误 C2076

无法在类型包含“auto/decltype(auto)”的新表达式中使用带括号的初始化表达式列表

如果 auto 类型说明符出现在新类型标识符或 new 表达式的类型标识符的说明符序列中,则表达式必须包含表单 ( assignment-expression ) 的初始化表达式。 编译器从初始化表达式中的 assignment-expression 推断类型标识符。 例如,

new auto(42);            // new allocates int
auto c = new auto('a');  // c is of type char*, new allocates char
new (auto*)(static_cast<short*>(nullptr));   // allocates type short*

若要解决此问题,请使用括号将 new 表达式的初始化值括起来。