From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0C9293858D3C; Sun, 7 May 2023 04:28:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C9293858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683433738; bh=GQUGJo2SdUCrlX6juUOGP+d1H7yHrGXJMpF4ApkFUcE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jKWOtH2vVJhrwUivuz1W7wcJnGRdWql9DB8wEshYCriI9gvaE3wRFn7baSqGv/vwe V4IXN4zlUuA5tYTVAl/WfQ7+uljQCZHS3H0QxKz49qVoF4KMPT+BJMbrsILJKq0u+k VGL2vZLskpmJ47szkFKjZs5jp78s8/+dOT+SHosY= From: "pinskia at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109763 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #1 from Andrew Pinski --- 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 =3D std::same_as ; If you do: static_assert(test); GCC will tell you know test is false even: :10:15: error: static assertion failed 10 | static_assert(test); | ^~~~~~~ :10:15: note: constraints not satisfied /opt/compiler-explorer/gcc-trunk-20230506/include/c++/14.0.0/concepts:57:15= :=20=20 required for the satisfaction of '__same_as<_Tp, _Up>' [with _Tp =3D decltype(T::func); _Up =3D int(int)] /opt/compiler-explorer/gcc-trunk-20230506/include/c++/14.0.0/concepts:62:13= :=20=20 required for the satisfaction of 'same_as' [w= ith T =3D D] :5:39: error: invalid use of non-static member function 'int D::func(int)' 5 | concept test =3D std::same_as ; | ^ concepts are supposed to be Subsitutation is not a failure proof for the re= ason they are replacements for that for improved testing.=