Compiler Error C2382
'function' : redefinition; different exception specifications
This error indicates that a function overload was attempted only on the exception specification.
Remarks
By default, the compiler considers a noexcept
specification to be equivalent to a throw()
or throw(some_type)
specification. Under /Za
, this check is more strict.
To resolve this issue, change all declarations and definitions of the function (or the specific function overload) to use the same exception specification.
Example
The following sample generates C2382:
// C2382.cpp
// compile with: /Za /c
void f1(void) noexcept {}
void f1(void) {} // C2382
void f2(void) throw() {} // OK
See also
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