From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 92DC93858D1E; Fri, 30 Sep 2022 10:54:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92DC93858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664535242; bh=/8zWlPaRWKHT3YxG7sQF/qRYalMwjpcMgLCSowWV9V4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dyKIG4/q1+U9RTkyRWBh7XyE3gx+pxuO2842Afmq6gdMiUUam0PIEEAJT9fyL+YvY T7vS0xPdYcMFLo1Amis5X6v7Byp/kv1+0Nld6LTJxlAtuCaneBHxRuKaAXAHFjUAb0 /djDVam84y450kZ3Sn0z9wqd2vRVUDzYjHmxsqrc= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/107092] std::for_each_n and its friends incorrectly accept size parameters that are not convertible to an integer type Date: Fri, 30 Sep 2022 10:54:02 +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.1.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: redi 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: everconfirmed cf_reconfirmed_on 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=3D107092 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2022-09-30 Status|UNCONFIRMED |NEW --- Comment #1 from Jonathan Wakely --- The reason I added overloads for floating-point types is that they can be converted to integral types. But if you read "is convertible to **an** inte= gral type" as meaning unambiguously convertible to exactly one integral type, th= en that's not true for FP types. I did add tests for PR 87982 that FP types can be used, but I don't think t= here were any pre-existing tests, and maybe nobody needs that. I could retain support for real FP types, but reject your testcase, like th= is: constexpr long long __size_to_integer(floating_point auto __n) { return (long long)__n; } But maybe I should just drop the FP overloads.=