E2018 Cannot catch 'identifier' -- ambiguous base class 'identifier' (C++)
Go Up to Compiler Errors And Warnings (C++) Index
It is not legal to catch a class that contains more than one copy of a (non-virtual) base class. However, you can catch the exception as a more derived type. For example:
struct awkward : std::runtime_error, std::logic_error {}; try { } catch( std::exception & ) { // ambiguous, not caught here } catch( std::runtime_error & ) { // caught here }
Note that the compiler might warn you that the second catch cannot be triggered because the first clause should catch all matching exceptions. But the ambiguous base case is caught by the second clause.