From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 450B53858D35; Sun, 9 Jan 2022 10:23:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 450B53858D35 From: "iamsupermouse at mail dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/103951] New: [C++2b] string_view range constructor, "exception specification ... depends on itself" Date: Sun, 09 Jan 2022 10:23:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: iamsupermouse at mail dot ru 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 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: Sun, 09 Jan 2022 10:23:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103951 Bug ID: 103951 Summary: [C++2b] string_view range constructor, "exception specification ... depends on itself" Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: iamsupermouse at mail dot ru Target Milestone: --- Following code compiles with -std=3Dc++20 and earlier, but fails with -std= =3Dc++2b, in both GCC and Clang with libstdc++, with similar errors. I've tested both on GCC 11.2 and on trunk 12.0.0 20220109 at gcc.godbolt.or= g. #include struct Iter { Iter() {} Iter(std::string_view) {} // Adding `explicit` fixes the error Iter begin() const { return *this; } }; It's supposed to be used as `for (auto x : Iter(...))`, exactly like `fs::directory_iterator`, but I've removed `end()` and overloaded operators= for brevity. The error message boils down to `return *this` considering the `string_view` constructor, which checks `Iter` against `contiguous_range`, which circular= ly checks `begin()`. I'm not sure if the code is legal or not, but the error is very unintuitive= , so I decided to report it. I would expect this to be a soft SFINAE failure.=