From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 67B4638515E0; Thu, 2 Sep 2021 22:13:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 67B4638515E0 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/102181] std::advance and std::views::iota don't work Date: Thu, 02 Sep 2021 22:13:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2021 22:13:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102181 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #5 from Jonathan Wakely --- (In reply to Raffael Casagrande from comment #3) > MSVC compiles the snippet without problems... It looks like they do not correctly implement iota_view. This C++20 proposa= l, specifically: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1522r1.pdf This program fails with MSVC: #include int main() { using type =3D uint64_t; // using type =3D int works! auto v =3D std::views::iota(0ull, ~0ull); auto b =3D v.end() - v.begin(); static_assert(!std::same_as); } It is required to compile. You cannot use int64_t to represent the differen= ce type of an iota_view with that many elements. I think GCC is correct according to the standard.=