Boost logo

Boost :

Subject: Re: [boost] The noexcept Specifier & Block
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2009-04-16 19:44:17


On Thu, Apr 16, 2009 at 15:28, Alexander Terekhov <terekhov_at_[hidden]> wrote:
> http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2855.html#noexcept
>
> I gather that
>
>  noexcept void f() {
>    throw 0;
>  }
>
> is supposed to be ill-formed versus well-formed
>
>  noexcept void f() {
>    noexcept { throw 0; }
>  }
>
> invoking undefined behaviour.
>
> Well, this is not helpful.
>
> Both forms shall be well-formed with defined behaviour: invocation of
> unexpected() at throw point.
>

But then if you have this:

 noexcept void f() {
   noexcept { bar(); }
 }

I don't see how you're going to get the "at throw point" you're asking for.

There's always catch (...) if you need to make sure, so treating it as
a "ok, I'll believe you" mark in the compiler makes good sense to me.

I figure it'd end up like const: A real pain to add in just a few
places if you don't use it much, but once it propagates around it'd
because automatic and rarely bypassed.

~ Scott


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk