编译器错误 C2711

"function":此函数不能编译为托管,请考虑使用 #pragma 非托管

某些指令将阻止编译器为封闭函数生成 MSIL。

以下示例生成 C2711:

// C2711.cpp
// compile with: /clr
// processor: x86
using namespace System;
value struct V {
   static const t = 10;
};

void bar() {
   V::t;
   __asm int 3   // C2711 inline asm can't be compiled managed
}