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

/Za (Disable language extensions)