Compiler Warning (level 1) C4382
throwing 'type' : a type with __clrcall destructor or copy constructor can only be caught in /clr:pure module
Remarks
The /clr:pure compiler option is deprecated in Visual Studio 2015 and unsupported in Visual Studio 2017.
When compiled with /clr (not /clr:pure), exception handling expects the member functions in a native type to be __cdecl and not __clrcall. Native types with member functions using __clrcall
calling convention cannot be caught in a module compiled with /clr.
If the exception will be caught in a module compiled with /clr:pure, you can ignore this warning.
For more information, see /clr (Common Language Runtime Compilation).
Example
The following sample generates C4382.
// C4382.cpp
// compile with: /clr /W1 /c
struct S {
__clrcall ~S() {}
};
struct T {
~T() {}
};
int main() {
S s;
throw s; // C4382
S * ps = &s;
throw ps; // OK
T t;
throw t; // OK
}
Feedback
https://aka.ms/ContentUserFeedback.
În curând: Pe parcursul anului 2024, vom elimina treptat Probleme legate de GitHub ca mecanism de feedback pentru conținut și îl vom înlocui cu un nou sistem de feedback. Pentru mai multe informații, consultați:Trimiteți și vizualizați feedback pentru