共用方式為


編譯器錯誤 C2743

'type' : 無法攔截具有__clrcall解構函式或複製建構函式的原生類型

使用 /clr 編譯的模組嘗試攔截原生類型的例外狀況,以及類型解構函式或複製建構函式使用 __clrcall 呼叫慣例的位置。

使用 /clr 編譯時,例外狀況處理會預期原生類型中的成員函式__cdecl,而不是__clrcall。 使用呼叫慣例搭配成員函式的原生型別無法在以 __clrcall /clr 編譯的模組中攔截。

如需詳細資訊,請參閱 /clr (Common Language Runtime 編譯)

範例

下列範例會產生 C2743。

// C2743.cpp
// compile with: /clr
public struct S {
   __clrcall ~S() {}
};

public struct T {
   ~T() {}
};

int main() {
   try {}
   catch(S) {}   // C2743
   // try the following line instead
   // catch(T) {}

   try {}
   catch(S*) {}   // OK
}