Reporting a Bug in exception handling involving multiple inheritance and templates - GCC 2.95.2

Martin v. Loewis
Fri Dec 31 20:54:00 GMT 1999

> The following program produces an Abort core dump between printing
> "Test3" and "Test4".

Thanks for your bug report. This is not a bug in g++, but in your
program. To see this, put the lines

  AAExcept<std::logic_error> x("junk");
  std::exception &e = x;

into your program; gcc will then say

  type `exception' is ambiguous base class for type `AAExcept<logic_error,AAException>'

Because you inherit std::exception in two bases, conversion is
ambiguous, and fails at runtime. That's why the exception is not
caught. So the program calls std::terminate, which calls abort.


More information about the Gcc-bugs mailing list