--- Comment #1 from Jonathan Wakely <redi at gcc dot> ---
(In reply to David Krauss from comment #0)
> This is not conforming.

Hmm, I think that's debatable.

[func.wrap.func.con] says:

  Throws: shall not throw exceptions if f’s target is a callable object
  passed via reference_wrapper or a function pointer.

By your interpretation, it is impossible for the target to be a callable object
passed by reference_wrapper, because the target will be the reference_wrapper
itself. This wording seems to imply that when the function(F) constructor is
passed a reference_wrapper<T> the target should be the wrapped T.

However, the function(F) constructor doesn't say anything like that, it says
"*this targets a copy of f".

So I'm tempted to say this is a defect in the standard. The copy constructor is
trying to be helpful, and say it won't throw under certain conditions, but it
does so confusingly.

Reply via email to