public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/102894] New: make_any is not SFINAE-friendly
@ 2021-10-22 9:40 de34 at live dot cn
2021-10-22 21:41 ` [Bug libstdc++/102894] " redi at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: de34 at live dot cn @ 2021-10-22 9:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102894
Bug ID: 102894
Summary: make_any is not SFINAE-friendly
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: de34 at live dot cn
Target Milestone: ---
std::make_any is specified in [any.nonmembers] p2-3 via "Effects: Equivalent
to: ...". According to [structure.specifications] p4, it propagates the
"Constraints:" of the constructor (in [any.cons] p11 and p17), and thus
SFINAE-friendly.
The following program should fail to compile. But currently it compiles with
libstdc++ due to lack of constraints. Note that std::make_optional is correctly
constrained in libstdc++.
Wandbox link:https://wandbox.org/permlink/noMWBjdCp0hg1pEZ
#include <type_traits>
#include <utility>
#include <any>
namespace test {
template<class T, class... Args>
auto test_make_any(int)
-> decltype((void)std::make_any<T>(std::declval<Args>()...),
std::true_type{});
template<class, class...>
auto test_make_any(...) -> std::false_type;
template<class T, class... Args>
inline constexpr bool can_make_any = decltype(test_make_any<T,
Args...>(0))::value;
}
int main()
{
static_assert(test::can_make_any<int, int, int>); // should not pass
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/102894] make_any is not SFINAE-friendly
2021-10-22 9:40 [Bug libstdc++/102894] New: make_any is not SFINAE-friendly de34 at live dot cn
@ 2021-10-22 21:41 ` redi at gcc dot gnu.org
2021-10-22 22:10 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-10-22 21:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102894
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2021-10-22
Status|UNCONFIRMED |ASSIGNED
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/102894] make_any is not SFINAE-friendly
2021-10-22 9:40 [Bug libstdc++/102894] New: make_any is not SFINAE-friendly de34 at live dot cn
2021-10-22 21:41 ` [Bug libstdc++/102894] " redi at gcc dot gnu.org
@ 2021-10-22 22:10 ` cvs-commit at gcc dot gnu.org
2021-10-22 22:11 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-22 22:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102894
--- Comment #1 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:0c1f737a485f05c591c94b50acfb416c45a4c916
commit r12-4634-g0c1f737a485f05c591c94b50acfb416c45a4c916
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Oct 22 22:55:00 2021 +0100
libstdc++: Constrain std::make_any [PR102894]
std::make_any should be constrained so it can only be called if the
construction of the return value would be valid.
libstdc++-v3/ChangeLog:
PR libstdc++/102894
* include/std/any (make_any): Add SFINAE constraint.
* testsuite/20_util/any/102894.cc: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/102894] make_any is not SFINAE-friendly
2021-10-22 9:40 [Bug libstdc++/102894] New: make_any is not SFINAE-friendly de34 at live dot cn
2021-10-22 21:41 ` [Bug libstdc++/102894] " redi at gcc dot gnu.org
2021-10-22 22:10 ` cvs-commit at gcc dot gnu.org
@ 2021-10-22 22:11 ` redi at gcc dot gnu.org
2021-11-24 11:51 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-10-22 22:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102894
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |10.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/102894] make_any is not SFINAE-friendly
2021-10-22 9:40 [Bug libstdc++/102894] New: make_any is not SFINAE-friendly de34 at live dot cn
` (2 preceding siblings ...)
2021-10-22 22:11 ` redi at gcc dot gnu.org
@ 2021-11-24 11:51 ` cvs-commit at gcc dot gnu.org
2021-11-26 16:35 ` cvs-commit at gcc dot gnu.org
2021-11-26 16:48 ` redi at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-24 11:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102894
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:88d481c9ee1e6a24dc11ab56d8688308e0211855
commit r11-9293-g88d481c9ee1e6a24dc11ab56d8688308e0211855
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Oct 22 22:55:00 2021 +0100
libstdc++: Constrain std::make_any [PR102894]
std::make_any should be constrained so it can only be called if the
construction of the return value would be valid.
libstdc++-v3/ChangeLog:
PR libstdc++/102894
* include/std/any (make_any): Add SFINAE constraint.
* testsuite/20_util/any/102894.cc: New test.
(cherry picked from commit 0c1f737a485f05c591c94b50acfb416c45a4c916)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/102894] make_any is not SFINAE-friendly
2021-10-22 9:40 [Bug libstdc++/102894] New: make_any is not SFINAE-friendly de34 at live dot cn
` (3 preceding siblings ...)
2021-11-24 11:51 ` cvs-commit at gcc dot gnu.org
@ 2021-11-26 16:35 ` cvs-commit at gcc dot gnu.org
2021-11-26 16:48 ` redi at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-26 16:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102894
--- Comment #3 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:923637b6cb70986e83ae0109ec4bcd26fdfe3624
commit r10-10308-g923637b6cb70986e83ae0109ec4bcd26fdfe3624
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Oct 22 22:55:00 2021 +0100
libstdc++: Constrain std::make_any [PR102894]
std::make_any should be constrained so it can only be called if the
construction of the return value would be valid.
libstdc++-v3/ChangeLog:
PR libstdc++/102894
* include/std/any (make_any): Add SFINAE constraint.
* testsuite/20_util/any/102894.cc: New test.
(cherry picked from commit 0c1f737a485f05c591c94b50acfb416c45a4c916)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/102894] make_any is not SFINAE-friendly
2021-10-22 9:40 [Bug libstdc++/102894] New: make_any is not SFINAE-friendly de34 at live dot cn
` (4 preceding siblings ...)
2021-11-26 16:35 ` cvs-commit at gcc dot gnu.org
@ 2021-11-26 16:48 ` redi at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-26 16:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102894
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 11.3 and 10.4, thanks for the report.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-11-26 16:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22 9:40 [Bug libstdc++/102894] New: make_any is not SFINAE-friendly de34 at live dot cn
2021-10-22 21:41 ` [Bug libstdc++/102894] " redi at gcc dot gnu.org
2021-10-22 22:10 ` cvs-commit at gcc dot gnu.org
2021-10-22 22:11 ` redi at gcc dot gnu.org
2021-11-24 11:51 ` cvs-commit at gcc dot gnu.org
2021-11-26 16:35 ` cvs-commit at gcc dot gnu.org
2021-11-26 16:48 ` 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).