From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by sourceware.org (Postfix) with ESMTPS id 8FE363846035 for ; Tue, 27 Apr 2021 07:58:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8FE363846035 Received: by mail-ed1-x531.google.com with SMTP id e7so68737449edu.10 for ; Tue, 27 Apr 2021 00:58:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PaBIN5A3c5IVI+VgX4jEZgNn/ebOSdPfiXiGVeqKYi8=; b=lhQWcOIT79Cyh2qUzH4SB7hWnTNpr6iSaIDReWKeZ5jhkOoSUMijXAKf9E4R2vsOXT D/csZYjb29xfC7tPQqPwITx9nNcMR2CZv2ksf+b4csm3Axk2Ad0OSWnoqILm3ROQ2w0V N61iEc615sfYaqoQmzsOKP3LEUcjf16w92HsTSXy7nSQ6PSBBhpIJuebYR3PN5fGoLNi TVtrfk4hYcnInmt+LCkbqbBFmaM0dyyNcHoc2ENplc0ZRSVxiS9hhfqAMoTp03UUc7n5 YKrKQtcDAhr8uIUuwlbPz7wuoermx3R6vzbKnBd+PUrazEhub4kJBBn+X9S2zou7NLtM FFiQ== X-Gm-Message-State: AOAM530G++PCiQMeCu9Hxd4qQFd0a6uf/ZE6HUqjfpSbwiXMVe1ZE37c 0gyNUHmqnBmhwcbXzrkbaoBlZAPXb2kC7g0Omuo= X-Google-Smtp-Source: ABdhPJwY/r9l0TRwp8vz+x4JSbuWxkkv5PndRRENY1YPgpqu1p6F4DvW3zbAOu7aYNmjo0DZzY1/K5SZaPbIcipXaKk= X-Received: by 2002:aa7:c44b:: with SMTP id n11mr1304912edr.214.1619510337720; Tue, 27 Apr 2021 00:58:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Tue, 27 Apr 2021 09:58:47 +0200 Message-ID: Subject: Re: [PATCH] define auto_vec copy ctor and assignment (PR 90904) To: Martin Sebor Cc: gcc-patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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, 27 Apr 2021 07:58:59 -0000 On Tue, Apr 27, 2021 at 2:46 AM Martin Sebor via Gcc-patches wrote: > > PR 90904 notes that auto_vec is unsafe to copy and assign because > the class manages its own memory but doesn't define (or delete) > either special function. Since I first ran into the problem, > auto_vec has grown a move ctor and move assignment from > a dynamically-allocated vec but still no copy ctor or copy > assignment operator. > > The attached patch adds the two special functions to auto_vec along > with a few simple tests. It makes auto_vec safe to use in containers > that expect copyable and assignable element types and passes bootstrap > and regression testing on x86_64-linux. The question is whether we want such uses to appear since those can be quite inefficient? Thus the option is to delete those operators? Richard. > Martin