[英]Expected type-specifier before ';' token
我收到错误消息“';'之前的预期类型说明符” 令牌”在下面标记的代码行中。 是否要求指定(* this)的类型? 为什么编译器不知道(* this)的类型?
struct P{
};
struct R : public P{
virtual P* copy(){
return new(R(*this)); //error here
}
};
您需要说: return new R(*this);
这就是非放置new
表达式的形式。 没有多余的括号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.