Section: 22.214.171.124 [reentrancy] Status: Open Submitter: Stephan T. Lavavej Opened: 2014-07-01 Last modified: 2021-07-31 10:46:51 UTC
View all other issues in [reentrancy].
View all issues with Open status.
N3936 126.96.36.199 [reentrancy]/1 talks about "functions", but that doesn't address the scenario of calling different member functions of a single object. Member functions often have to violate and then re-establish invariants. For example, vectors often have "holes" during insertion, and element constructors/destructors/etc. shouldn't be allowed to observe the vector while it's in this invariant-violating state. The [reentrancy] Standardese should be extended to cover member functions, so that implementers can either say that member function reentrancy is universally prohibited, or selectively allowed for very specific scenarios.(For clarity, this issue has been split off from LWG 2382.)
AJM confirmed with SG1 that they had no special concerns with this issue, and LWG should retain ownership.AM: this is too overly broad as it also covers calling the exact same member function on a different object
Move to Open
[2015-07 Telecon Urbana]
Marshall to ping STL for updated wording.
[2016-05 email from STL]
I don't have any better suggestions than my original PR at the moment.
Previous resolution [SUPERSEDED]:
This wording is relative to N3936.
Change 188.8.131.52 [reentrancy] p1 as indicated:
-1- Except where explicitly specified in this standard, it is implementation-defined which functions in the Standard C++ library may be recursively reentered.
[2021-07-29 Tim suggests new wording]
The "this pointer" restriction is modeled on 11.9.5 [class.cdtor] p2. It allows us to continue to specify a member function f as calling some other member function g, since any such call would use something obtained from the first member function's this pointer.In all other cases, this wording disallows such "recursion on object" unless both member functions are const (or are treated as such for the purposes of data race avoidance). Using "access" means that we also cover direct access to the object representation, such as the following pathological example from Arthur O'Dwyer, which is now undefined:
std::string s = "hello world"; char *first = (char*)&s; char *last = (char*)(&s + 1); s.append(first, last);
This wording is relative to N4892.
Add the following paragraph to 184.108.40.206 [reentrancy]: