Boost logo

Boost :

Subject: Re: [boost] Boost and exceptions
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2012-06-23 17:51:05

On 23/06/2012 19:24, Robert Ramey wrote:
> Kim Barrett wrote:
>> boost::throw_exception (in the interesting case, where
>> ensures that the thrown object is derived from boost::exception even
>> if the argument is not. (...) (Note that throw requires the argument to be copy
>> constructible, so the described mechanism imposes no new constraint on
>> E by requiring copy construction.)
> So any boost library which previously
> used boost::throw exception with an exception which was non-copyable
> would break? I guess we're lucky no one did that.

Anyone throwing anything by means of throw that isn't copyable would
break. This is a standard requirement, not a boost::throw_exception one.

Reading from n3376 at [except.throw] 15.1.3:
A throw-expression copy-initializes (8.5) a temporary object, called the
exception object, the type of which is determined by removing any
top-level cv-qualifiers from the static type of the operand of throwand
adjusting the type from “array of T” or “function returning T” to
“pointer to T” or “pointer to function returning T”, respectively. The
temporary is an lvalue and is used to initialize the variable named in
the matching handler (15.3). If the type of the exception object would
be an incomplete type or a pointer to an incomplete type other than
(possibly cv-qualified) voidthe program is ill-formed. Except for these
restrictions and the restrictions on type matching mentioned in15.3, the
operand of throwis treated exactly as a function argument in a call
(5.2.2) or the operand of a return statement.

Agustín K-ballo Bergé.-

Boost list run by bdawes at, gregod at, cpdaniel at, john at