From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2CA673858D38; Sun, 30 Oct 2022 20:40:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2CA673858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667162404; bh=ItaNz6MBMnReEmzRIe8rejw/S3OeFK+HSzpTbKq+eXo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dax9GGgRMiP42HOEbJv3jKGoi9/k8g4psnUVxhP+RC9DZoNgJh+c3dO3oZEP3m+G/ 2VUCFUu/dBjD9Hq904HbmMK6U4gHceis9UuRFqBGXOu1L6oM8YuSR5nBhRktqB2RnT XyjTXNLK610s0EmPYtVhQi3RzvSsTHd2TXmoE/Jg= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107466] [12/13 Regression] invalid -Wnarrowing error with std::subtract_with_carry_engine Date: Sun, 30 Oct 2022 20:40:03 +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: 12.2.0 X-Bugzilla-Keywords: diagnostic, rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org 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: 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=3D107466 --- Comment #2 from Jonathan Wakely --- I don't think this is a compiler bug. Converting that value to uint16_t is narrowing. The problem is that the standard requires subtract_with_carry_engine to = use linear_congruential_engine where each of those values is converted to T. This appears to mean subtract_with_carry_engine cannot be used with uint16_= t.=