Compiler Warning (level 1) C4674
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Warning (level 1) C4674.
method' should be declared 'static' and have exactly one parameter
The signature of a conversion operator was not correct. The method is not considered a user-defined conversion.
When using the new syntax (/clr), see User-Defined Operators (C++/CLI) and User-Defined Conversions (C++/CLI) for information on defining operators.
The following sample generates C4674.
// C4674.cpp
// compile with: /clr /WX /W1 /LD
ref class G {
int op_Implicit(int i) { // C4674
return 0;
}
};
The following sample generates C4674.
// C4674_b.cpp
// compile with: /clr:oldSyntax /W1 /LD
__gc class G {
int op_Implicit(int i) { // C4674
// try the following line instead
// static int op_Implicit(int i) {
return 0;
}
};
Show: