public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gcc-bugs at marehr dot dialup.fu-berlin.de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94673] [concepts] What is the return type of local parameters of requires expressions? Date: Tue, 21 Sep 2021 19:00:43 +0000 [thread overview] Message-ID: <bug-94673-4-uj5vWXshXB@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-94673-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94673 gcc-bugs at marehr dot dialup.fu-berlin.de changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |WORKSFORME Status|UNCONFIRMED |RESOLVED --- Comment #5 from gcc-bugs at marehr dot dialup.fu-berlin.de --- (In reply to Patrick Palka from comment #4) > Don't we already do this with -fconcepts-diagnostics-depth=2 ? You are right, sorry! Haven't checked that again thoroughly, and it seems that you do. > -fconcepts-diagnostics-depth=2 will produce ``` <source>:18:15: error: static assertion failed 18 | static_assert(foo<int &&>); // fails with clang | ^~~~~~~~~~~ <source>:18:15: note: constraints not satisfied <source>:9:9: required by the constraints of 'template<class t> concept foo' <source>:9:15: in requirements with 't v' [with t = int&&] <source>:11:6: note: 'v' does not satisfy return-type-requirement, because 11 | {v} -> std::same_as<t &>; | ~^~~~~~~~~~~~~~~~~~~~~~~ <source>:11:6: error: deduced expression type does not satisfy placeholder constraints <source>:11:6: note: constraints not satisfied In file included from /opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/compare:39, from /opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/bits/stl_pair.h:65, from /opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/utility:70, from <source>:1: /opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/concepts:57:15: required for the satisfaction of '__same_as<_Tp, _Up>' [with _Tp = int&&; _Up = int&] /opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/concepts:62:13: required for the satisfaction of 'same_as<decltype(auto) [requires std::same_as<<placeholder>, t&>], t&>' [with decltype(auto) [requires std::same_as<<placeholder>, t&>] = int&&; t = int&&] /opt/compiler-explorer/gcc-11.1.0/include/c++/11.1.0/concepts:57:32: note: the expression 'is_same_v<_Tp, _Up> [with _Tp = int&&; _Up = int&]' evaluated to 'false' 57 | concept __same_as = std::is_same_v<_Tp, _Up>; | ``` It seems that the behaviour changed again in gcc-11: ``` template <typename t> concept foo = requires(t v) { {v} -> same_as<t &>; }; static_assert(foo<int &&>); // true in gcc-10, false in gcc-11 ``` Thank you again, from my POV can be closed.
prev parent reply other threads:[~2021-09-21 19:00 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-20 17:18 [Bug c++/94673] New: " gcc-bugs at marehr dot dialup.fu-berlin.de 2020-04-20 17:43 ` [Bug c++/94673] " gcc-bugs at marehr dot dialup.fu-berlin.de 2021-09-20 21:23 ` arthur.j.odwyer at gmail dot com 2021-09-20 22:48 ` gcc-bugs at marehr dot dialup.fu-berlin.de 2021-09-21 17:48 ` ppalka at gcc dot gnu.org 2021-09-21 19:00 ` gcc-bugs at marehr dot dialup.fu-berlin.de [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-94673-4-uj5vWXshXB@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).