This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

3416. The Throws: specification of std::any does not mention allocation

Section: 20.8.4 [any.class] Status: New Submitter: Thomas Köppe Opened: 2020-03-04 Last modified: 2020-04-04

Priority: 3

View all other issues in [any.class].

View all issues with New status.


Several of the function specifications in 20.8.4 [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:

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.

[2020-04-04 Issue Prioritization]

Priority to 3 after reflector discussion.

Proposed resolution: