Export (0) Print
Expand All
Expand Minimize

Compiler Error C2694

'override': overriding virtual function has less restrictive exception specification than base class virtual member function 'base'

A virtual function was overridden, but under /Za, the overriding function had a less restrictive exception specification.

The following sample generates C2694:

// C2694.cpp
// compile with: /Za
class MyBase
{
public:
   virtual void f(void) throw(int) {
   }
};

class Derived : public MyBase
{
public:
   void f(void) throw(...) {   // C2694
   // try the following line instead
   // void f(void) throw(int){
   }      
};

int main()
{
}
Show:
© 2014 Microsoft