Compiler Error C3890
'var' : you cannot take the address of a literal data member
A literal data member exists on the garbage-collected heap. An object on the garbage-collected heap can be moved, so taking the address is not useful.
The following sample generates C3890:
// C3890.cpp
// compile with: /clr
ref struct Y1 {
literal int staticConst = 9;
};
int main() {
int p = &Y1::staticConst; // C3890
int p2 = Y1::staticConst; // OK
}
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