Jeroen T. Vermeulen wrote:
> On Wed, January 24, 2007 19:28, Bart Samwel wrote:
> 
>> Since
>> std::exception is not a virtual base class of std::logic_error or
>> std::runtime_error, the base class std::exception will be ambiguous, and
>> according to the C++ standard, item 15.3.3 (numbering of the TC2003
>> version) only catch clauses for unambiguous public base classes qualify
>> as matches. This means that catch(const std::exception&) will not catch
>> an exception object that is multiply inherited from logic_error and
>> runtime_error. Bummer. :-)
> 
> Nasty one!
> 
> I have toyed with the idea of making std::exception a virtual base class
> of the new mixin, but that would cause trouble in view of this rule,
> right?

Yes. TC2003::10.1.6 says that if a class is present a virtual base 
through one path, and as a nonvirtual base through another, that these 
classes are not merged, i.e., you keep multiple ambiguous base classes.

> (I know virtual inheritance is generally something we'd want to avoid
> anyway, but exceptions are not where we tie ourselves down to
> optimizations)

Agreed.

Cheers,
Bart
_______________________________________________
Libpqxx-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general

Reply via email to