4129. Possibly incorrect wording for data race avoidance

Section: 16.4.6.10 [res.on.data.races] Status: New Submitter: Jiang An Opened: 2024-07-30 Last modified: 2024-08-03

Priority: Not Prioritized

View other active issues in [res.on.data.races].

View all other issues in [res.on.data.races].

View all issues with New status.

Discussion:

From PR cplusplus/draft#6748 which was closed as non-editorial.

Currently, 16.4.6.10 [res.on.data.races] is talking about arguments and "including this", but this is not a function argument. Moreover, it seems more appropriate to say that a function accesses some object via a parameter.

It might need to be considered whether we should use the more general term "range" instead of "container", which will cover std::span, etc.

Proposed resolution:

This wording is relative to N4986.

  1. Modify 16.4.6.10 [res.on.data.races] as indicated:

    -2- A C++ standard library function shall not directly or indirectly access objects (6.9.2 [intro.multithread]) accessible by threads other than the current thread unless the objects are accessed directly or indirectly via the function's argumentsparameters, including thisthe object parameter (if any).

    -3- A C++ standard library function shall not directly or indirectly modify objects (6.9.2 [intro.multithread]) accessible by threads other than the current thread unless the objects are accessed directly or indirectly via the function's non-const argumentsparameters, including thisthe object parameter (if any).

    […]

    -5- A C++ standard library function shall not access objects indirectly accessible via its argumentsparameters or via elements of its container argumentsparameters except by invoking functions required by its specification on those container elements.