The Throws: specification of std::any does not mention allocation
Thomas Köppe

Created on 2020-03-04.00:00:00 last changed 3 months ago


Date: 2020-04-04.00:00:00

[ 2020-04-04 Issue Prioritization ]

Priority to 3 after reflector discussion.

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.

Date User Action Args
2020-04-04 19:02:52adminsetmessages: + msg11189
2020-03-04 00:00:00admincreate