From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C3D9B3858C50; Thu, 9 Feb 2023 07:25:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C3D9B3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675927559; bh=0yUJQPlen1UV+3snyJWiOYVNT8TrAsDEjqjcjh3VkWs=; h=From:To:Subject:Date:From; b=XM408Y3jiiQyWQcXcHz5X+6Cp0JpDeSxsXcRnVPg/KpNwhTv/SFLxYyBd9+iMA6th VBuUkBGhY3KeyypOUW1MwuucgUkEF6jyuUPhDDv6fyJzY+akzJi6dYNTTVEbTukQBz +5hnVAi1PQutDelyvkErXsvAJm1kZMIm1W+UF8LE= From: "ldalessandro at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108736] New: pconcepts] multidimensional subscript operator reports invalid error in requires test Date: Thu, 09 Feb 2023 07:25:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ldalessandro at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 Bug ID: 108736 Summary: pconcepts] multidimensional subscript operator reports invalid error in requires test Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ldalessandro at gmail dot com Target Milestone: --- The following code produces an error when evaluating the concept. auto foo(auto a, auto... i) -> decltype(auto) { if constexpr (requires { a[i...]; }) { return a[i...]; } else { return a; } } int x =3D foo(1); > : In instantiation of 'decltype(auto) foo(auto:1, auto:2 ...) [wi= th auto:1 =3D int; auto:2 =3D {}]': > :10:12: required from here > :2:31: error: built-in subscript operator without expression list > 2 | if constexpr (requires { a[i...]; }) { > | ~^ > Compiler returned: 1 Workaround: specialize on sizeof...(i) to avoid this test when i... is empt= y. Live example: https://godbolt.org/z/K3oezd1qz=