Compiler Error C3352
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 Error C3352.
function' : the specified function does not match the delegate type 'type'
The parameter lists for function and the delegate do not match.
For more information, see delegate (C++ Component Extensions).
The following sample generates C3352:
// C3352.cpp
// compile with: /clr
delegate int D( int, int );
ref class C {
public:
int mf( int ) {
return 1;
}
// Uncomment the following line to resolve.
// int mf(int, int) { return 1; }
};
int main() {
C^ pC = gcnew C;
System::Delegate^ pD = gcnew D( pC, &C::mf ); // C3352
}
The following sample generates C3352:
// C3352_2.cpp
// compile with: /clr:oldSyntax
__delegate int D(int, int);
__gc class C {
public:
int mf(int) {
return 1;
}
// Uncomment the following line to resolve.
// int mf(int, int) { return 1; }
};
int main() {
C *pC = new C;
System::Delegate *pD = new D(pC, &C::mf); // C3352
}
Show: