From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id D02BF383D80F for ; Wed, 11 Aug 2021 13:23:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D02BF383D80F Received: by mail-wm1-x334.google.com with SMTP id o1-20020a05600c5101b02902e676fe1f04so3785379wms.1 for ; Wed, 11 Aug 2021 06:23:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=+0vHvyL5HfgSew67ltDPo6wfQP1YOYhBJqWDWg74Xa8=; b=I7KSY5m5YjG5P796NhZoBPHq/k4PzFz5esVh3PB3C5eoL84cO7BdfhKO7tVEuHznif erKmFicsgQC3XB88o8gGJIn75QrnH7vdnka1VVOe+troaL+8pQ8Tb5KZL2ixv13r21pO js/GNoFJ/BBZwpALI1igDk7EH6Tjon7JkJwveJVVgiGDeelvcqwz/oa5Z5PFzm/cBzS/ AalSSMX1A1f5dixR2uJrlMafB6hgxpMFLvm3nmqlpg5xjWnP8aeK0gE5I/hv0NNM5UvO sIXc+MBf54VAzVEwEo9fABjRleP8/ErJjwOXvKWdYnd2MXLtRjV9VWSN5ScMz1J0vOy2 MyOg== X-Gm-Message-State: AOAM533N8XFMVPy+Vjq4PZ7KO3W6HlboBI/xjdFsKskLeGrdbXXlLN5P T/ez7GxMd2wPAYFFQs2TOD3kEduvEpw= X-Google-Smtp-Source: ABdhPJzulNBqb7v+AeDb3+gKcThP0DsAGAO7/JTCQVTR3/q268PsHa8njTidlfssHFjH2eOB+XQFHg== X-Received: by 2002:a7b:c922:: with SMTP id h2mr3597916wml.186.1628688180461; Wed, 11 Aug 2021 06:23:00 -0700 (PDT) Received: from [192.168.42.121] (pop.92-184-100-131.mobile.abo.orange.fr. [92.184.100.131]) by smtp.googlemail.com with ESMTPSA id g4sm1879317wrb.18.2021.08.11.06.22.58 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Aug 2021 06:22:59 -0700 (PDT) To: "libstdc++@gcc.gnu.org" From: =?UTF-8?Q?Fran=c3=a7ois_Dumont?= Subject: Unexpected greedy ops failure Message-ID: Date: Wed, 11 Aug 2021 15:22:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------ACAD79455D7B71A9DE28DC32" Content-Language: en-US X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_WEB, SPF_HELO_NONE, SPF_PASS, 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: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2021 13:23:12 -0000 This is a multi-part message in MIME format. --------------ACAD79455D7B71A9DE28DC32 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit With the patch proposed in: https://gcc.gnu.org/pipermail/libstdc++/2021-August/053009.html to extend some _GLIBCXX_DEBUG checks in _GLIBCXX_ASSERTIONS I have 2 tests in failure: Running target unix/-D_GLIBCXX_DEBUG Running /home/fdt/dev/gcc/git/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp ... FAIL: 23_containers/deque/types/1.cc (test for excess errors) FAIL: 23_containers/vector/types/1.cc (test for excess errors) The error is: /home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/helper_functions.h:96: error: ambiguous overload for 'operator-' in '__rhs - __lhs' (operand types are 'std::move_iterator' and 'std::move_iterator') In file included from /home/fdt/dev/gcc/git/libstdc++-v3/testsuite/23_containers/vector/types/1.cc:24: /home/fdt/dev/gcc/git/libstdc++-v3/testsuite/util/testsuite_greedy_ops.h:48: note: candidate: 'greedy_ops::X greedy_ops::operator-(T, T) [with T = std::move_iterator]' In file included from /home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:67,                  from /home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/vector:60,                  from /home/fdt/dev/gcc/git/libstdc++-v3/testsuite/23_containers/vector/types/1.cc:23: /home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_iterator.h:1692: note: candidate: 'constexpr decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&) [with _IteratorL = gree dy_ops::X*; _IteratorR = greedy_ops::X*; decltype ((__x.base() - __y.base())) = long int]' compiler exited with status 1 FAIL: 23_containers/vector/types/1.cc (test for excess errors) I really don"t understand the link between the failures and this patch. But at the same time I am surprised that there is no definition for operator-(const move_iterator&, const move_iterator&) in the library (like in attached patch). With this change the failure vanishes. Moreover is there a reason for having added several operators as normal std namespace operators rather than inline friend like in my patch ? I know we already talk about it but I don't remember if the reply was that we cannot do it or I simply forgot to propose the patch to do so. Thanks, François --------------ACAD79455D7B71A9DE28DC32 Content-Type: text/x-patch; charset=UTF-8; name="move_iterator.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="move_iterator.patch" diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index a8986d11dfe..4c46fd43a8d 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -1534,6 +1534,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return std::move(_M_current[__n]); } #endif + [[__nodiscard__]] + friend _GLIBCXX17_CONSTEXPR difference_type + operator-(const move_iterator& __x, const move_iterator& __y) + { return __x.base() - __y.base(); } + #if __cplusplus > 201703L && __cpp_lib_concepts template _Sent> [[nodiscard]] --------------ACAD79455D7B71A9DE28DC32--