This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/21334] Lack of Posix compliant thread safety in std::basic_string


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21334

--- Comment #45 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-31 15:54:05 UTC ---
Thanks for the patch, I'll take a look asap.

Just to answer this older comment ...

(In reply to comment #35)
> Who said that calling begin() on a non const std::string should be thread safe
> ?

For the record, as it hasn't been mentioned here explicitly, C++11 says it:

23.2.2 Container data races [container.requirements.dataraces]
-1- For purposes of avoiding data races (17.6.5.9), implementations shall
consider the following functions to be const: begin, end, rbegin, rend, front,
back, data, find, lower_bound, upper_bound, equal_range, at and, except in
associative or unordered associative containers, operator[].

So in C++11 this is definitely a bug (but then a COW string is non-conforming
in other ways too, which is why it will go away when the ABI is changed.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]