From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id A4DD03858007 for ; Tue, 28 Sep 2021 19:26:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A4DD03858007 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-501-_DVnejybNq2ugaFacKhQLg-1; Tue, 28 Sep 2021 15:25:58 -0400 X-MC-Unique: _DVnejybNq2ugaFacKhQLg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 52781802C88; Tue, 28 Sep 2021 19:25:57 +0000 (UTC) Received: from localhost (unknown [10.33.36.241]) by smtp.corp.redhat.com (Postfix) with ESMTP id 050A360854; Tue, 28 Sep 2021 19:25:56 +0000 (UTC) Date: Tue, 28 Sep 2021 20:25:56 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Improve types used as iterators in testsuite Message-ID: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="vBAndRIxFxPSzT56" Content-Disposition: inline X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 19:26:03 -0000 --vBAndRIxFxPSzT56 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * testsuite/25_algorithms/copy/34595.cc: Add missing operation for type used as an iterator. * testsuite/25_algorithms/unique_copy/check_type.cc: Likewise. Tested x86_64-linux. Committed to trunk. --vBAndRIxFxPSzT56 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit 5f1db7627f6eea2050c3d71f17bca5ecf586a813 Author: Jonathan Wakely Date: Fri Sep 24 13:23:34 2021 libstdc++: Improve types used as iterators in testsuite Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * testsuite/25_algorithms/copy/34595.cc: Add missing operation for type used as an iterator. * testsuite/25_algorithms/unique_copy/check_type.cc: Likewise. diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/34595.cc b/libstdc++-v3/testsuite/25_algorithms/copy/34595.cc index c534eeb17f5..513425a5a2c 100644 --- a/libstdc++-v3/testsuite/25_algorithms/copy/34595.cc +++ b/libstdc++-v3/testsuite/25_algorithms/copy/34595.cc @@ -27,11 +27,12 @@ class Counting_output_iterator public: Counting_output_iterator() : c(0) {} Counting_output_iterator& operator++() { return *this; } + Counting_output_iterator operator++(int) { return *this; } Counting_output_iterator& operator*() { return *this; } - + template void operator=(const T&) { ++c; } - + std::size_t current_counter() const { return c; } }; diff --git a/libstdc++-v3/testsuite/25_algorithms/unique_copy/check_type.cc b/libstdc++-v3/testsuite/25_algorithms/unique_copy/check_type.cc index af86548609f..27b35794e8a 100644 --- a/libstdc++-v3/testsuite/25_algorithms/unique_copy/check_type.cc +++ b/libstdc++-v3/testsuite/25_algorithms/unique_copy/check_type.cc @@ -25,27 +25,35 @@ using __gnu_test::input_iterator_wrapper; using __gnu_test::output_iterator_wrapper; -struct S1 { }; +template +struct iter_facade +{ + T& operator++(); + T operator++(int); + T& operator*() const; +}; -struct S2 +struct S1 : iter_facade { }; + +struct S2 : iter_facade { S2(const S1&) {} }; -bool +bool operator==(const S1&, const S1&) {return true;} -struct X1 { }; +struct X1 : iter_facade { }; -struct X2 +struct X2 : iter_facade { X2(const X1&) {} }; -bool +bool predicate(const X1&, const X1&) {return true;} -output_iterator_wrapper +output_iterator_wrapper test1(input_iterator_wrapper& s1, output_iterator_wrapper& s2) { return std::unique_copy(s1, s1, s2); } --vBAndRIxFxPSzT56--