Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.08 KB

compiler-warning-level-4-c4339.md

File metadata and controls

43 lines (33 loc) · 1.08 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 4) C4339
Compiler Warning (level 4) C4339
11/04/2016
C4339
C4339
5b83353d-7777-4afb-8476-3c368349028c

Compiler Warning (level 4) C4339

'type' : use of undefined type detected in WinRT or CLR meta-data - use of this type may lead to a runtime exception

A type was not defined in code that was compiled for Windows Runtime or the common language runtime. Define the type to avoid a possible runtime exception.

This warning is off by default. See Compiler Warnings That Are Off by Default for more information.

The following sample generates C4339 and shows how to fix it:

// C4339.cpp
// compile with: /W4 /clr /c
// C4339 expected
#pragma warning(default : 4339)

// Delete the following line to resolve.
class A;

// Uncomment the following line to resolve.
// class A{};

class X {
public:
   X() {}

   virtual A *mf() {
      return 0;
   }
};

X * f() {
   return new X();
}