public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109763] GCC accepts invalid program involving decltype(classtype::memberfunction) when used with concepts Date: Sun, 07 May 2023 04:28:57 +0000 [thread overview] Message-ID: <bug-109763-4-PkSNBPWFWR@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109763-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109763 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Concepts are not supposed to error out if there was an error but rather turn into false. clang does not error out either. GCC correctly rejects if test is defined as: template < typename T > constexpr bool test = std::same_as <decltype(T::func), int(int) >; If you do: static_assert(test<D>); GCC will tell you know test<D> is false even: <source>:10:15: error: static assertion failed 10 | static_assert(test<D>); | ^~~~~~~ <source>:10:15: note: constraints not satisfied /opt/compiler-explorer/gcc-trunk-20230506/include/c++/14.0.0/concepts:57:15: required for the satisfaction of '__same_as<_Tp, _Up>' [with _Tp = decltype(T::func); _Up = int(int)] /opt/compiler-explorer/gcc-trunk-20230506/include/c++/14.0.0/concepts:62:13: required for the satisfaction of 'same_as<decltype (T::func), int(int)>' [with T = D] <source>:5:39: error: invalid use of non-static member function 'int D::func(int)' 5 | concept test = std::same_as <decltype(T::func), int(int) >; | ^ concepts are supposed to be Subsitutation is not a failure proof for the reason they are replacements for that for improved testing.
next prev parent reply other threads:[~2023-05-07 4:28 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-07 4:16 [Bug c++/109763] New: " jlame646 at gmail dot com 2023-05-07 4:28 ` pinskia at gcc dot gnu.org [this message] 2023-05-07 4:29 ` [Bug c++/109763] " pinskia at gcc dot gnu.org 2023-05-07 4:31 ` pinskia at gcc dot gnu.org 2023-05-07 5:43 ` jlame646 at gmail dot com 2023-05-07 5:45 ` jlame646 at gmail dot com 2023-05-07 9:19 ` jlame646 at gmail dot com 2023-05-07 10:43 ` pinskia at gcc dot gnu.org 2023-05-07 10:45 ` pinskia at gcc dot gnu.org 2023-05-07 11:08 ` jlame646 at gmail dot com 2023-05-08 4:02 ` jlame646 at gmail dot com
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-109763-4-PkSNBPWFWR@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).