error: expected '(' for function-style cast or type construction.
请教下各位,这个error要如何翻译成中文比较好?
在下有点懵逼了……
阿神2017-04-17 13:30:51
Error: Expecting a '(' for function-style type conversion and type construction
I remember that there seems to be an error caused by calling a function that does not accept parameters and then forgetting to type (). Of course Maybe I remembered it wrong, or there are other reasons
天蓬老师2017-04-17 13:30:51
This may mean that C-style forced data conversion was used during the data conversion process and was used incorrectly. The compiler recommends using C++-style type conversion.
迷茫2017-04-17 13:30:51
Functional style conversion or constructor requires "("
This is a syntax error reported by the compiler. The compiler should think that your code is performing type conversion or writing a constructor but you did not add parentheses.
Functional style conversion:
class A {}
auto i = A(0); // Because it looks like a function call, it is called functional style conversion; unique to C++
Type construction:
class foo
{
foo() { /*...*/ } // type construction(实质上就是构造函数)
}