Skip to content

Conversation

@eisenwave
Copy link
Member

@eisenwave eisenwave commented Oct 20, 2024

As part of #7261.

This PR fixes numerous issues with [basic.stc.dynamic.general] p1:

  1. "dynamically" is not defined in the standard, and the paragraph does not define it (judging by formatting), so this term is meaningless.

  2. The paragraph specifically states "during program execution", but C++20 allows the user to create dynamic storage duration objects during program translation, i.e. within constant evaluation.

  3. The explanation given here is not exhaustive. Normative wording in [basic.stc.general] p2 already states "The dynamic storage duration is associated with objects created by a new-expression ([expr.new]) or with implicitly created objects ([intro.object]).". Notably, implicitly created objects are not mentioned in [basic.stc.dynamic.general].

It is worth noting that the new definition explicitly gives dynamic storage duration to objects, which is inconsistent with the other definitions. For example, [basic.stc.static] says:

All variables which [...] have static storage duration.

@jensmaurer has stated in #6523 (comment) that we have long-standing problems with the term "variable". At first sight, this may be a blocker for this edit.

However, this editorial issue does not introduce a novel problem because [expr.new] p10 already states:

Objects created by a new-expression have dynamic storage duration ([basic.stc.dynamic]).

In other words, this PR makes no normative changes. It aggregates existing wording from [expr.new] and [basic.stc.general] and replaces old incorrect or incomplete wording.

@eisenwave eisenwave force-pushed the fix-dynamic-storage-duration branch 2 times, most recently from c25d800 to 78f2a9c Compare October 20, 2024 18:32
@eisenwave eisenwave force-pushed the fix-dynamic-storage-duration branch from 78f2a9c to b764786 Compare October 20, 2024 18:50
@eisenwave eisenwave requested a review from jensmaurer July 25, 2025 17:22
@eisenwave eisenwave added the P2-Bug Presentational errors and omissions label Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2-Bug Presentational errors and omissions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants