Compiler Error C2311

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C2311.

exception' : is caught by '...' on line number

The catch handler for the ellipsis (...) must be the last handler for a throw.

The following sample generates C2311:

// C2311.cpp  
// compile with: /EHsc  
#include <eh.h>  
int main() {  
   try {  
      throw "ooops!";  
   }  
   catch( ... ) {}  
   catch( int ) {}   // C2311  ellipsis handler not last catch  
}  

Show: