Compiler Warning (level 3) C4534
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Warning (level 3) C4534

Error Message

'constructor' will not be a default constructor for class 'class' due to the default argument

An unmanaged class can have a constructor with parameters that have default values and the compiler will use this as the default constructor. A class marked with the value keyword will not use a constructor with default values for its parameters as a default constructor.

For more information, see Classes and Structs (Managed).

The following sample generates C4534:

// C4534.cpp
// compile with: /W3 /clr /WX
value class MyClass {
   int ii;
   MyClass(int i = 9) {   // C4534, will not be the default constructor

int main() {
   MyClass ^ xx = gcnew MyClass;
   xx->ii = 0;
© 2015 Microsoft