From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 306B03938C30; Wed, 6 May 2020 15:30:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 306B03938C30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588779018; bh=Kq7raNlEXKWfvKt6KB8Y2LmF8q+o98ooVRMvPo7AeVs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QGzu3KPfhD7jLxFoYZgTyaFZF3L2DGGbq9Sv/ZKwyLCP2Xj3DWaa28KYXHFpVq64v M5R7vcaceyQa5R3C61rqnM05jufM7+1+j8saYOT5Iw8wSyhOLJ8B7UVp+Z/A6J599F 9QhJ4x5GGm4zNiR5ODzz62pkRJ45HdngJwtHvc48= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/92472] enhancement: 5 * constify some parameters Date: Wed, 06 May 2020 15:30:18 +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: 10.0 X-Bugzilla-Keywords: internal-improvement X-Bugzilla-Severity: enhancement X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED 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 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: Wed, 06 May 2020 15:30:18 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D92472 --- Comment #12 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #11) > (In reply to David Binderman from comment #10) > > I am still not sure if the new code is ok or not, >=20 > Wasn't "This is 400% wrong" clear? Here's the error it caused: /home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/para= llel/multiway_merge.h:273: error: no match for 'operator<' in '__seq2 < __seq0' (operand types are '__gnu_parallel::_GuardedIterator<__gnu_cxx::__normal_iterator >, std::less >' a= nd '__gnu_parallel::_GuardedIterator<__gnu_cxx::__normal_iterator >, std::less >') /home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/para= llel/multiway_merge.h:120: note: candidate: 'bool __gnu_parallel::operator<(__gnu_parallel::_GuardedIterator<__gnu_cxx::__nor= mal_iterator >, std::less >&, __gnu_parallel::_GuardedIterator<__gnu_cxx::__normal_iterator >, const std::less >&)' /home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/para= llel/multiway_merge.h:121: note: no known conversion for argument 2 from '__gnu_parallel::_GuardedIterator<__gnu_cxx::__normal_iterator >, std::less >' to '__gnu_parallel::_GuardedIterator<__gnu_cxx::__normal_iterator >, const std::less >&' And the reason it's wrong is that const Foo& and Foo& are completely different things. Your patch made *one* of the parameters Foo& (which is wrong because it's never called with anything matching = that type) and left the other parameter unchanged (which is even more wrong, bec= ause now the operator can't be used to compare two objects of the same type). ( https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545214.html=