Title
The Throws: specification of std::any does not mention allocation
Status
new
Section
[any.class]
Submitter
Thomas Köppe

Created on 2020-03-04.00:00:00 last changed 1 month ago

Messages

Date: 2020-03-04.00:00:00

Several of the function specifications in [any.class] have Throws: elements, but those only mention "exceptions thrown by a constructor". It seems necessary for std::any to perform dynamic allocation in general, and so in general there should be a possibility of an exception raised by such dynamic allocation. (This may come from a user-provided T::operator new, as far as I can tell.)

We should revise the specifications to add relevant sources of exceptions.

The functions that should probably mention allocations are:

  • any(const any& other)

  • template<class T> any(T&& value)

  • both any(in_place_t<T>, …) overloads

  • any& operator=(const any& rhs)

  • template<class T> any& operator=(T&& rhs)

  • all emplace overloads

Proposed wording: None yet. Maybe insert something like "thrown by unspecified, internal bookkeeping logic" into each Throws: element, but perhaps something more specific is necessary.

History
Date User Action Args
2020-03-04 00:00:00admincreate