Compiler Error C3271
'member': invalid value 'value' for the FieldOffset attribute
A negative number was passed to the FieldOffset attribute.
The following sample generates C3271:
// C3271.cpp
// compile with: /clr /c
using namespace System;
using namespace System::Runtime::InteropServices;
[StructLayout(LayoutKind::Explicit)]
value class MyStruct1 {
public: [FieldOffset(0)] int a;
public: [FieldOffset(-1)] long b; // C3271
};
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for