From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 513A8389853F; Wed, 6 May 2020 10:07:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 513A8389853F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588759660; bh=sGRPRLzKp2zInwSz8SEY+xG2oo/kfNLeR/balnLL1Js=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PeYCDymdzIKRYr8VGgYEdm0j+h8ZMi5g5B3Go7pcqP7I7ie6O8H7vBYmD14YIP78y horZnakb2TUGi1Pgqte4msLKsmXUQy26ZtFBz+2WKqKUau3a8ALEVQPdAZevBPV26c NBy+ZKhsTVruoFKd1mzZW8QNZlgFBmrTIbqBohs4= 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 10:07:40 +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 10:07:40 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D92472 --- Comment #6 from Jonathan Wakely --- (In reply to David Binderman from comment #0) > Message: >=20 > trunk/libstdc++-v3/include/parallel/multiway_merge.h:121:40: style: > Parameter '__bi2' can be declared with const [constParameter] > trunk/libstdc++-v3/include/parallel/multiway_merge.h:191:42: style: > Parameter '__bi2' can be declared with const [constParameter] >=20 > Patch: >=20 > Index: libstdc++-v3/include/parallel/multiway_merge.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- libstdc++-v3/include/parallel/multiway_merge.h (revision 278050) > +++ libstdc++-v3/include/parallel/multiway_merge.h (working copy) > @@ -118,7 +118,7 @@ > * @return @c true if less. */ > friend bool > operator<(_GuardedIterator<_RAIter, _Compare>& __bi1, > - _GuardedIterator<_RAIter, _Compare>& __bi2) > + _GuardedIterator<_RAIter, const _Compare>& __bi2) > { > if (__bi1._M_current =3D=3D __bi1._M_end) // __bi1 is sup > return __bi2._M_current =3D=3D __bi2._M_end; // __bi2 is not sup > @@ -188,7 +188,7 @@ > * @return @c true if less. */ > friend bool > operator<(_UnguardedIterator<_RAIter, _Compare>& __bi1, > - _UnguardedIterator<_RAIter, _Compare>& __bi2) > + _UnguardedIterator<_RAIter, const _Compare>& __bi2) > { > // Normal compare. > return (__bi1.__comp)(*__bi1, *__bi2); This is 400% wrong. It doesn't even address what cppcheck is complaining ab= out, and cppcheck is drunk anyway. Those parameter can NOT be const, because *__= b1 and *__b2 will not compile if they're const, because operator* is not const. > All patches seemed to bootstrap ok. But what about testing them?=