Compiler Error C3824
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 C3824.
member': this type cannot appear in this context (function parameter, return type, or a static member)
Pinning pointers cannot be function parameters, return types, or declared static.
The following sample generates C3824:
// C3824a.cpp
// compile with: /clr /c
void func() {
static pin_ptr<int> a; // C3824
pin_ptr<int> b; // OK
}
Managed Extensions for C++
Local pointers declared with the __pin keyword cannot be declared static and cannot be interior pointers.
The following sample generates C3824:
// C3824b.cpp
// compile with: /clr:oldSyntax /c
#using <mscorlib.dll>
__gc struct A {};
void func() {
static A __pin* a; // C3824
A __pin* b; // OK
}
Show: