Compiler Error C3354
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 C3354.
function' : the function used to create a delegate cannot have return type 'type'
The following types are invalid as return types for a delegate:
Pointer to function
Pointer to member
Pointer to member function
Reference to function
Reference to member function
The following sample generates C3354:
// C3354_2.cpp // compile with: /clr /c using namespace System; typedef void ( *VoidPfn )(); delegate VoidPfn func(); // C3354 // try the following line instead // delegate void func();
The following sample generates C3354:
// C3354.cpp // compile with: /clr:oldSyntax /c #using <mscorlib.dll> using namespace System; typedef void (*VoidPfn)(); __delegate VoidPfn func(); // C3354 // try the following line instead // __delegate void func();
Show: