Compiler Error C2581
'type' : static 'operator =' function is illegal
The assignment (=
) operator is incorrectly declared as static
. Assignment operators cannot be static
. For more information, see User-Defined Operators (C++/CLI).
Example
The following sample generates C2581.
// C2581.cpp
// compile with: /clr /c
ref struct Y {
static Y ^ operator = (Y^ me, int i); // C2581
Y^ operator =(int i); // OK
};
Athugasemdir
https://aka.ms/ContentUserFeedback.
Væntanlegt: Á árinu 2024 munum við hætta með GitHub-mál sem ábendingaleið fyrir efni og skipta því út fyrir nýtt ábendingakerfi. Frekari upplýsingar er að finna hér:Senda inn og skoða endurgjöf fyrir