From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 9820A3875474; Thu, 23 Jul 2020 09:24:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9820A3875474 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1595496282; bh=oNB7NMwSBIjA+0jb3fGHt1bVmkPkeWQoeDCY1LKZogA=; h=From:To:Subject:Date:From; b=S0hNHkYPUHprzEokF6pgXJ/1FPWNjsHyM1kxWi+4zjuKnO/xQZOqfL+XTu4BNIBYV th8r57CuLNcSckCNVKTPtP+HY0ErFdqeulRZmE2T9Arx9Ppmq3/h+gQg479uBxDxkn y8MCOybAZf2SRF9StuStVvf30t+osQyl4JmVLomc= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/redhat/heads/gcc-10-branch)] PR libstdc++/95915 X-Act-Checkin: gcc X-Git-Author: Ville Voutilainen X-Git-Refname: refs/vendors/redhat/heads/gcc-10-branch X-Git-Oldrev: 62175c503703b8c1242153ed01b550278f794c07 X-Git-Newrev: deb9c51ca71d3cb507dd91ab8bfd8c1021effd9f Message-Id: <20200723092442.9820A3875474@sourceware.org> Date: Thu, 23 Jul 2020 09:24:42 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jul 2020 09:24:42 -0000 https://gcc.gnu.org/g:deb9c51ca71d3cb507dd91ab8bfd8c1021effd9f commit deb9c51ca71d3cb507dd91ab8bfd8c1021effd9f Author: Ville Voutilainen Date: Mon Jun 29 00:36:38 2020 +0300 PR libstdc++/95915 PR libstdc++/95915 * include/std/variant (_Uninitialized): Adjust the condition and the comment. * testsuite/20_util/variant/95915.cc: New. * testsuite/20_util/variant/compile.cc: Add new test. (cherry picked from commit 24b54628cfa95194a8de4071c28cb56e6e81c08e) Diff: --- libstdc++-v3/include/std/variant | 12 ++------ libstdc++-v3/testsuite/20_util/variant/95915.cc | 35 +++++++++++++++++++++++ libstdc++-v3/testsuite/20_util/variant/compile.cc | 7 +++++ 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index 258a5fb18bd..010138df9f2 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -202,15 +202,9 @@ namespace __variant std::forward<_Variants>(__variants)...); } - // _Uninitialized is guaranteed to be a literal type, even if T is not. - // We have to do this, because [basic.types]p10.5.3 (n4606) is not implemented - // yet. When it's implemented, _Uninitialized can be changed to the alias - // to T, therefore equivalent to being removed entirely. - // - // Another reason we may not want to remove _Uninitialzied may be that, we - // want _Uninitialized to be trivially destructible, no matter whether T - // is; but we will see. - template> + // _Uninitialized is guaranteed to be a trivially destructible type, + // even if T is not. + template> struct _Uninitialized; template diff --git a/libstdc++-v3/testsuite/20_util/variant/95915.cc b/libstdc++-v3/testsuite/20_util/variant/95915.cc new file mode 100644 index 00000000000..411ff2d36ae --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/variant/95915.cc @@ -0,0 +1,35 @@ +// { dg-options "-std=gnu++20" } +// { dg-do compile { target c++20 } } + +// 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 +// . + +#include + +using namespace std; + +struct virtual_default_dtor { + virtual ~virtual_default_dtor() = default; +}; + +void default_ctor() +{ + { + variant a; + } +} + diff --git a/libstdc++-v3/testsuite/20_util/variant/compile.cc b/libstdc++-v3/testsuite/20_util/variant/compile.cc index a53071c8867..4f2ed68426a 100644 --- a/libstdc++-v3/testsuite/20_util/variant/compile.cc +++ b/libstdc++-v3/testsuite/20_util/variant/compile.cc @@ -84,6 +84,10 @@ struct nonliteral bool operator>(const nonliteral&) const; }; +struct virtual_default_dtor { + virtual ~virtual_default_dtor() = default; +}; + void default_ctor() { static_assert(is_default_constructible_v>); @@ -95,6 +99,9 @@ void default_ctor() static_assert(noexcept(variant())); static_assert(!noexcept(variant())); static_assert(noexcept(variant())); + { + variant a; + } } void copy_ctor()