https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68784
--- Comment #3 from Jonathan Wakely ---
(In reply to Wang Xuancong from comment #2)
> All standards are made by people. No standard is perfect. If a standard
> causes more inconvenience to the users, then it is considered sub-optimal
> and has
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68784
Jonathan Wakely changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68784
--- Comment #5 from Ville Voutilainen ---
And to add insult to injury, msvc accepts binding lvalue reference to
temporaries, and chances are that their thread constructor does what it does
partly because of that non-conforming core language
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68784
--- Comment #2 from Wang Xuancong ---
All standards are made by people. No standard is perfect. If a standard causes
more inconvenience to the users, then it is considered sub-optimal and has room
for improvement.
Thus, unless you can give me a
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68784
--- Comment #4 from Jonathan Wakely ---
(In reply to Wang Xuancong from comment #0)
> g++ require explicit reference cast:
> t[0] = thread(thread_add, ref(ht), 0, 9);
With that change your program has a data race due to modifying the same
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68784
--- Comment #6 from Wang Xuancong ---
You are right! I have tested myself. MSVC outputs 0 instead of crashing
(crashing is what we expected), it is accepting compilation but not doing the
job correctly, that it passes a temporarily created copy
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68784
--- Comment #7 from Jonathan Wakely ---
That is a reasonable design, but it is not the design used by the C++11
standard library. This is not the right place to debate the merits of a very
intentional decision made by a large group of experts