Compiler Error C2313
Visual Studio 2015
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 C2313.
type1' : is caught by reference ('type2') on line number
The exception type has two handlers. The type for the second catch is a reference to the type of the first.
The following sample generates C2313:
// C2313.cpp
// compile with: /EHsc
#include <eh.h>
class C {};
int main() {
try {
throw "ooops!";
}
catch( C& ) {}
catch( C ) {} // C2313
}
Show: