编译器错误 C3272
“symbol”:符号需要 FieldOffset,因为它是用 StructLayout(LayoutKind::Explicit) 定义的 typename 类型的成员
当 StructLayout(LayoutKind::Explicit)
有效时,必须用 FieldOffset
来标记字段。
下面的示例生成 C3272:
// C3272_2.cpp
// compile with: /clr /c
using namespace System;
using namespace System::Runtime::InteropServices;
[StructLayout(LayoutKind::Explicit)]
ref struct X
{
int data_; // C3272
// try the following line instead
// [FieldOffset(0)] int data_;
};
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈