public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/97876] New: stop_token header doesn't compile on clang-8 with -std=c++20
@ 2020-11-17 17:29 eric.niebler at gmail dot com
2020-11-17 19:19 ` [Bug libstdc++/97876] " redi at gcc dot gnu.org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: eric.niebler at gmail dot com @ 2020-11-17 17:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97876
Bug ID: 97876
Summary: stop_token header doesn't compile on clang-8 with
-std=c++20
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: eric.niebler at gmail dot com
Target Milestone: ---
Compiling <stop_token> header with clang-8 in C++20 mode results in this:
In file included from
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/condition_variable:50:
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/stop_token:404:7:
error: default member initializer for '_M_ptr' needed within definition of
enclosing class 'stop_token' outside of member functions
_Stop_state_ref() = default;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/stop_token:478:21:
note: in evaluation of exception specification for
'std::stop_token::_Stop_state_ref::_Stop_state_ref' needed here
_Stop_state_ref _M_state;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/stop_token:58:5:
note: in evaluation of exception specification for
'std::stop_token::stop_token' needed here
stop_token() noexcept = default;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/stop_token:475:22:
note: default member initializer declared here
_Stop_state_t* _M_ptr = nullptr;
^
1 error generated.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/97876] stop_token header doesn't compile on clang-8 with -std=c++20
2020-11-17 17:29 [Bug libstdc++/97876] New: stop_token header doesn't compile on clang-8 with -std=c++20 eric.niebler at gmail dot com
@ 2020-11-17 19:19 ` redi at gcc dot gnu.org
2020-11-17 19:22 ` redi at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-17 19:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97876
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It works fine in Clang 9.0.0 though. We've never really set a hard limit on how
many old versions of Clang we support, but given that 9 and 10 (and trunk)
work, I'm inclined to think that three versions seems enough for new C++20
features.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/97876] stop_token header doesn't compile on clang-8 with -std=c++20
2020-11-17 17:29 [Bug libstdc++/97876] New: stop_token header doesn't compile on clang-8 with -std=c++20 eric.niebler at gmail dot com
2020-11-17 19:19 ` [Bug libstdc++/97876] " redi at gcc dot gnu.org
@ 2020-11-17 19:22 ` redi at gcc dot gnu.org
2020-11-17 21:19 ` eric.niebler at gmail dot com
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-17 19:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97876
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Changing the _Stop_state_ref default constructor to:
_Stop_state_ref() noexcept {}
allows it to compile. It shouldn't be needed, but I suppose since the
constructor is already non-trivial (due to the default member initializer that
is the cause of the error) we could do that.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/97876] stop_token header doesn't compile on clang-8 with -std=c++20
2020-11-17 17:29 [Bug libstdc++/97876] New: stop_token header doesn't compile on clang-8 with -std=c++20 eric.niebler at gmail dot com
2020-11-17 19:19 ` [Bug libstdc++/97876] " redi at gcc dot gnu.org
2020-11-17 19:22 ` redi at gcc dot gnu.org
@ 2020-11-17 21:19 ` eric.niebler at gmail dot com
2020-11-18 17:09 ` redi at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: eric.niebler at gmail dot com @ 2020-11-17 21:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97876
--- Comment #3 from Eric Niebler <eric.niebler at gmail dot com> ---
It seems like GitHub actions uses the latest libstdc++ by default when testing
even with old (e.g., clang-4) toolsets. That seems busted, but regardless, this
is now breaking _all_ my Linux clang tests for anything less than clang-9,
which is unfortunate.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/97876] stop_token header doesn't compile on clang-8 with -std=c++20
2020-11-17 17:29 [Bug libstdc++/97876] New: stop_token header doesn't compile on clang-8 with -std=c++20 eric.niebler at gmail dot com
` (2 preceding siblings ...)
2020-11-17 21:19 ` eric.niebler at gmail dot com
@ 2020-11-18 17:09 ` redi at gcc dot gnu.org
2020-11-19 21:24 ` eric.niebler at gmail dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-18 17:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97876
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Github's poor life choices should not be our problem ;-)
If clang-8 doesn't ship <stop_token> and doesn't work with GCC's <stop_token>,
I would interpret that as you can't test <stop_token> with clang-8.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/97876] stop_token header doesn't compile on clang-8 with -std=c++20
2020-11-17 17:29 [Bug libstdc++/97876] New: stop_token header doesn't compile on clang-8 with -std=c++20 eric.niebler at gmail dot com
` (3 preceding siblings ...)
2020-11-18 17:09 ` redi at gcc dot gnu.org
@ 2020-11-19 21:24 ` eric.niebler at gmail dot com
2020-11-19 21:39 ` redi at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: eric.niebler at gmail dot com @ 2020-11-19 21:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97876
--- Comment #5 from Eric Niebler <eric.niebler at gmail dot com> ---
> Github's poor life choices should not be our problem ;-)
I thought you'd say that. :-)
> If clang-8 doesn't ship <stop_token> and doesn't work with GCC's <stop_token>, I would interpret that as you can't test <stop_token> with clang-8.
Yeah, except I'm not trying to test <stop_token>. I'm just trying to include
<condition_variable>, which includes <stop_token> and hard-errors. In fact,
what I'm _really_ trying to do is include <regex>, which includes
<memory_resource>, which includes <shared_mutex>, which includes
<condition_variable>. All roads, it seems, lead to <stop_token>.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/97876] stop_token header doesn't compile on clang-8 with -std=c++20
2020-11-17 17:29 [Bug libstdc++/97876] New: stop_token header doesn't compile on clang-8 with -std=c++20 eric.niebler at gmail dot com
` (4 preceding siblings ...)
2020-11-19 21:24 ` eric.niebler at gmail dot com
@ 2020-11-19 21:39 ` redi at gcc dot gnu.org
2020-11-19 21:41 ` redi at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-19 21:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97876
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2020-11-19
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Ugh, OK, that's more problematic then.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/97876] stop_token header doesn't compile on clang-8 with -std=c++20
2020-11-17 17:29 [Bug libstdc++/97876] New: stop_token header doesn't compile on clang-8 with -std=c++20 eric.niebler at gmail dot com
` (5 preceding siblings ...)
2020-11-19 21:39 ` redi at gcc dot gnu.org
@ 2020-11-19 21:41 ` redi at gcc dot gnu.org
2020-11-19 22:54 ` redi at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-19 21:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97876
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
g:f5d9bc8ae81abe46640477bc9e655aa093947f5f removed the dependency from
<shared_mutex> on <condition_variable> for most targets.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/97876] stop_token header doesn't compile on clang-8 with -std=c++20
2020-11-17 17:29 [Bug libstdc++/97876] New: stop_token header doesn't compile on clang-8 with -std=c++20 eric.niebler at gmail dot com
` (6 preceding siblings ...)
2020-11-19 21:41 ` redi at gcc dot gnu.org
@ 2020-11-19 22:54 ` redi at gcc dot gnu.org
2020-11-20 13:27 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-19 22:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97876
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Target Milestone|--- |10.3
Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Backporting that to gcc-10 would break any code implicitly relying on
<condition_variable> being included by <regex>. I generally only do such header
dependency changes for major releases. Maybe it's OK, as it's only included for
C++17 mode, which isn't considered stable for gcc-10.
Separately, <regex> shouldn't need <memory_resource> when it already declares
polymorphic allocator (which is sufficient for <string> and <vector> and the
other headers with alias templates in std::pmr). It needs it because
pmr::string::const_iterator and pmr::wstring::const_iterator require string and
wstring to be complete, which requires polymorphic_allocator to be complete.
That's avoidable though:
--- a/libstdc++-v3/include/std/regex
+++ b/libstdc++-v3/include/std/regex
@@ -64,7 +64,6 @@
#include <bits/regex_executor.h>
#if __cplusplus >= 201703L && _GLIBCXX_USE_CXX11_ABI
-#include <memory_resource>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -74,11 +73,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using match_results
= std::match_results<_BidirectionalIterator, polymorphic_allocator<
sub_match<_BidirectionalIterator>>>;
- using cmatch = match_results<const char*>;
- using smatch = match_results<string::const_iterator>;
+ using cmatch = match_results<const char*>;
+ using smatch
+ = match_results<__gnu_cxx::__normal_iterator<const char*, string>>;
#ifdef _GLIBCXX_USE_WCHAR_T
using wcmatch = match_results<const wchar_t*>;
- using wsmatch = match_results<wstring::const_iterator>;
+ using wsmatch
+ = match_results<__gnu_cxx::__normal_iterator<const wchar_t*, wstring>>;
#endif
} // namespace pmr
_GLIBCXX_END_NAMESPACE_VERSION
I think removing that dependency in the gcc-10 branch should be OK too.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/97876] stop_token header doesn't compile on clang-8 with -std=c++20
2020-11-17 17:29 [Bug libstdc++/97876] New: stop_token header doesn't compile on clang-8 with -std=c++20 eric.niebler at gmail dot com
` (7 preceding siblings ...)
2020-11-19 22:54 ` redi at gcc dot gnu.org
@ 2020-11-20 13:27 ` cvs-commit at gcc dot gnu.org
2020-11-20 13:49 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-20 13:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97876
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:
https://gcc.gnu.org/g:640ebeb336050887cb57417b7568279c588088f0
commit r11-5199-g640ebeb336050887cb57417b7568279c588088f0
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Nov 20 11:30:33 2020 +0000
libstdc++: Remove <memory_resource> dependency from <regex> [PR 92546]
Unlike the other headers that declare alias templates in namespace pmr,
<regex> includes <memory_resource>. That was done because the
pmr::string::const_iterator typedef requires pmr::string to be complete,
which requires pmr::polymorphic_allocator<char> to be complete.
By using __normal_iterator<const char*, pmr::string> instead of the
const_iterator typedef we can avoid the completeness requirement.
This makes <regex> smaller, by not requiring <memory_resource> and its
<shared_mutex> dependency, which depends on <chrono>. Backporting this
will also help with PR 97876, where <stop_token> ends up being needed by
<regex> via <memory_resource>.
libstdc++-v3/ChangeLog:
PR libstdc++/92546
* include/std/regex (pmr::smatch, pmr::wsmatch): Declare using
underlying __normal_iterator type, not nested typedef
basic_string::const_iterator.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/97876] stop_token header doesn't compile on clang-8 with -std=c++20
2020-11-17 17:29 [Bug libstdc++/97876] New: stop_token header doesn't compile on clang-8 with -std=c++20 eric.niebler at gmail dot com
` (8 preceding siblings ...)
2020-11-20 13:27 ` cvs-commit at gcc dot gnu.org
@ 2020-11-20 13:49 ` cvs-commit at gcc dot gnu.org
2020-11-20 13:49 ` cvs-commit at gcc dot gnu.org
2020-11-20 13:57 ` redi at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-20 13:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97876
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:a186d72afd6cfb13efd4a0ec82049d79892334fd
commit r10-9056-ga186d72afd6cfb13efd4a0ec82049d79892334fd
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Nov 19 22:32:54 2020 +0000
libstdc++: Fix compilation error with clang-8 [PR 97876]
This fixes a compilation error with clang-8 and earlier. This change is
only on the gcc-10 branch, not master, because the <stop_token> header
is included indirectly in more places on the branch than on master.
PR libstdc++/97876
* include/std/stop_token (_Stop_state_t): Define default
constructor as user-provided not defaulted.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/97876] stop_token header doesn't compile on clang-8 with -std=c++20
2020-11-17 17:29 [Bug libstdc++/97876] New: stop_token header doesn't compile on clang-8 with -std=c++20 eric.niebler at gmail dot com
` (9 preceding siblings ...)
2020-11-20 13:49 ` cvs-commit at gcc dot gnu.org
@ 2020-11-20 13:49 ` cvs-commit at gcc dot gnu.org
2020-11-20 13:57 ` redi at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-20 13:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97876
--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:cbbc28706164873d0323d1a6c7988be3f4d971c9
commit r10-9057-gcbbc28706164873d0323d1a6c7988be3f4d971c9
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Nov 20 11:30:33 2020 +0000
libstdc++: Remove <memory_resource> dependency from <regex> [PR 92546]
Unlike the other headers that declare alias templates in namespace pmr,
<regex> includes <memory_resource>. That was done because the
pmr::string::const_iterator typedef requires pmr::string to be complete,
which requires pmr::polymorphic_allocator<char> to be complete.
By using __normal_iterator<const char*, pmr::string> instead of the
const_iterator typedef we can avoid the completeness requirement.
This makes <regex> smaller, by not requiring <memory_resource> and its
<shared_mutex> dependency, which depends on <chrono>. Backporting this
will also help with PR 97876, where <stop_token> ends up being needed by
<regex> via <memory_resource>.
libstdc++-v3/ChangeLog:
PR libstdc++/92546
* include/std/regex (pmr::smatch, pmr::wsmatch): Declare using
underlying __normal_iterator type, not nested typedef
basic_string::const_iterator.
(cherry picked from commit 640ebeb336050887cb57417b7568279c588088f0)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/97876] stop_token header doesn't compile on clang-8 with -std=c++20
2020-11-17 17:29 [Bug libstdc++/97876] New: stop_token header doesn't compile on clang-8 with -std=c++20 eric.niebler at gmail dot com
` (10 preceding siblings ...)
2020-11-20 13:49 ` cvs-commit at gcc dot gnu.org
@ 2020-11-20 13:57 ` redi at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-20 13:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97876
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #2)
> Changing the _Stop_state_ref default constructor to:
>
> _Stop_state_ref() noexcept {}
>
> allows it to compile. It shouldn't be needed, but I suppose since the
> constructor is already non-trivial (due to the default member initializer
> that is the cause of the error) we could do that.
I've done this on the gcc-10 branch, but not trunk. That means the same problem
will recur with clang-8 and <stop_token> in gcc-11.
However, I've also removed the <memory_resource> dependency from <regex> on
gcc-10 and trunk, and <shared_mutex> already stopped including <stop_token> on
trunk. So there are fewer routes to <stop_token> now.
Now you just need to wait for Ubuntu to update gcc-10 and for GitHub to deploy
that update, which I can't help with.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-11-20 13:57 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 17:29 [Bug libstdc++/97876] New: stop_token header doesn't compile on clang-8 with -std=c++20 eric.niebler at gmail dot com
2020-11-17 19:19 ` [Bug libstdc++/97876] " redi at gcc dot gnu.org
2020-11-17 19:22 ` redi at gcc dot gnu.org
2020-11-17 21:19 ` eric.niebler at gmail dot com
2020-11-18 17:09 ` redi at gcc dot gnu.org
2020-11-19 21:24 ` eric.niebler at gmail dot com
2020-11-19 21:39 ` redi at gcc dot gnu.org
2020-11-19 21:41 ` redi at gcc dot gnu.org
2020-11-19 22:54 ` redi at gcc dot gnu.org
2020-11-20 13:27 ` cvs-commit at gcc dot gnu.org
2020-11-20 13:49 ` cvs-commit at gcc dot gnu.org
2020-11-20 13:49 ` cvs-commit at gcc dot gnu.org
2020-11-20 13:57 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).