編譯器錯誤 C3831
'member': 'class' 不能有釘選的數據成員或傳回釘選指標的成員函式
pin_ptr (C++/CLI) 使用不正確。
範例
下列範例會產生 C3831:
// C3831a.cpp
// compile with: /clr
ref class Y
{
public:
int i;
};
ref class X
{
pin_ptr<int> mbr_Y; // C3831
int^ mbr_Y2; // OK
};
int main() {
Y y;
pin_ptr<int> p = &y.i;
}