Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Error C2521
Collapse the table of content
Expand the table of content

Compiler Error C2521

Error Message

function does not take any arguments

You attempted to use arguments with a destructor or finalizer.

For more information, see Destructors and Finalizers in Visual C++.

Example

The following sample generates C2521.

// C2521.cpp
// compile with: /clr
ref class R {
protected:
   !R() {}

public:
   void CleanUp() {
      this->!R(4);   // C2521
      this->!R();   // OK
   }
};

int main() {
   R^ r = gcnew R();
   r->CleanUp();
}

Community Additions

ADD
Show:
© 2015 Microsoft