From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113902 invoked by alias); 24 Feb 2020 23:27:02 -0000 Mailing-List: contact libstdc++-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libstdc++-owner@gcc.gnu.org Received: (qmail 113764 invoked by uid 89); 24 Feb 2020 23:27:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 24 Feb 2020 23:26:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582586817; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=d6DpDPD/KBHzS61jIhAyCvmPBO9lVtD7T+l2blcPBL0=; b=apZhNXaFpHbp9TrMxjQ903G/HvLl0cc7n7FGDX2y4tADxV6H4+SoGJnLIpT9YDoLHIGFjh Q80o2xSKJ4X/g7i6S08Jz3FPHZuMW/ZyR9mzn2993B4J50WmAEfeJf41+S4gmKYhJY+7eT diLvAgx3jtCXuUYY6RP9p4giznSQaNo= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-145-SJAM2NANMKSI6dSalVUfBw-1; Mon, 24 Feb 2020 18:26:51 -0500 Received: by mail-qt1-f197.google.com with SMTP id k20so12540825qtm.11 for ; Mon, 24 Feb 2020 15:26:51 -0800 (PST) Return-Path: Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id p126sm6547463qkd.108.2020.02.24.15.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 15:26:50 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, jwakely@redhat.com, Patrick Palka Subject: [PATCH] libstdc++: LWG 3292 iota_view is under-constrained Date: Mon, 24 Feb 2020 23:27:00 -0000 Message-Id: <20200224232643.851356-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00165.txt.bz2 libstdc++-v3/ChangeLog: LWG 3292 iota_view is under-constrained * include/std/ranges (iota_view): Require that _Winc models semiregular as per LWG 3292. * testsuite/std/ranges/iota/lwg3292_neg.cc: New test. --- libstdc++-v3/include/std/ranges | 1 + .../testsuite/std/ranges/iota/lwg3292_neg.cc | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 libstdc++-v3/testsuite/std/ranges/iota/lwg3292_neg.cc diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ran= ges index 0b2057c9661..ab8fbaca38f 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -615,6 +615,7 @@ namespace ranges template requires std::__detail::__weakly_eq_cmp_with<_Winc, _Bound> + && semiregular<_Winc> class iota_view : public view_interface> { private: diff --git a/libstdc++-v3/testsuite/std/ranges/iota/lwg3292_neg.cc b/libstd= c++-v3/testsuite/std/ranges/iota/lwg3292_neg.cc new file mode 100644 index 00000000000..80c392729b3 --- /dev/null +++ b/libstdc++-v3/testsuite/std/ranges/iota/lwg3292_neg.cc @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-options "-std=3Dgnu++2a" } +// { dg-do compile { target c++2a } } + +#include +#include + +namespace ranges =3D std::ranges; +namespace views =3D std::views; + +void +test01() +{ + std::istringstream s("1 2 3 4 5"); + auto v =3D ranges::istream_view(s); + auto i =3D v.begin(); + static_assert(!std::semiregular); + auto o =3D views::iota(std::move(i)); + static_assert(false); // { dg-error "" } +} + +// { dg-prune-output "no match" } +// { dg-prune-output "deduction failed" } +// { dg-prune-output "constraint failure" } --=20 2.25.1.291.ge68e29171c