From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46662 invoked by alias); 2 May 2015 10:12:25 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 46627 invoked by uid 48); 2 May 2015 10:12:21 -0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/65861] libstdc++ is silently generating wrong code when its std::search is given an input iterator Date: Sat, 02 May 2015 10:12:00 -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: 5.1.0 X-Bugzilla-Keywords: 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: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-05/txt/msg00075.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65861 --- Comment #9 from Jonathan Wakely --- There are actually good reasons *not* to reject input iterators at compile-time. You could have an iterator which meets most, but not all, the forward iterator requirements, and so must have input_iterator_tag as its category. Such as iterator could work fine with std::search, if we don't reject it via a static assertion. (istreambuf_iterator is not such an iterator, as it's genuinely a single-pass iterator, and so can't be used ... but we can't reliably detect that as the only property we can test is the iterator_category tag).