Share via


編譯程式警告 (層級 4, 關閉) C4339

'type':偵測到在 WinRT 或 CLR 中繼資料中使用未定義的類型 - 使用此類型可能造成執行階段例外狀況

類型未定義於針對 Windows 執行階段 或 Common Language Runtime 編譯的程式代碼中。 定義要避免可能的執行階段例外狀況的類型。

此警告預設為關閉。 如需詳細資訊,請參閱 Compiler Warnings That Are Off by Default

下列範例會產生 C4339,並示範如何修正此問題:

// 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();
}