From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6A4503858C5F; Thu, 9 Feb 2023 18:51:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A4503858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675968697; bh=oCzAcWIHANm5O9G5GmfE4BzEwvE3JwJ5oOFg/jDtL7w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kXLqWypJIVerLrfJITkTVA7TLkouUkOGP18FTTeBHPtpBEfKTRm6pxeoa0qNedIxS Wsh75T0DvRYfLPUNcQoLAobj06+TAlK9MOcnPZWLHQ9hyRXF98Yur416ZYC7/CPjIn 6/YwOmHJ0/FzmXUAUfp/hUH5VU3hIs46EK5KfBvY= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108736] [concepts] multidimensional subscript operator inside requires with variable template arguments is broken Date: Thu, 09 Feb 2023 18:51:37 +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.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: 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: short_desc bug_status everconfirmed cf_reconfirmed_on 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=3D108736 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[concepts] multidimensional |[concepts] multidimensional |subscript operator reports |subscript operator inside |invalid error in requires |requires with variable |test |template arguments is | |broken Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2023-02-09 --- Comment #1 from Andrew Pinski --- Confirmed, even this is rejected: ``` auto foo(auto a, auto... i) -> decltype(auto) { if constexpr (requires { a[i...]; }) { return a[i...]; } else { return a; } } int x =3D foo(1, 1); ``` Note clang just ICEs. Also the above works if it is not a variable argument auto ... That is: ``` template auto foo(T a, T1 i) { if constexpr (requires { a[i]; }) { return a[i]; } else { return a; } } int x =3D foo(1, 1); ``` Compiles just fine.=