public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/arm-perf-staging)] PR libstdc++/95915
@ 2020-07-17 15:33 Tamar Christina
0 siblings, 0 replies; only message in thread
From: Tamar Christina @ 2020-07-17 15:33 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:deb9c51ca71d3cb507dd91ab8bfd8c1021effd9f
commit deb9c51ca71d3cb507dd91ab8bfd8c1021effd9f
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
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<T> 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<T> can be changed to the alias
- // to T, therefore equivalent to being removed entirely.
- //
- // Another reason we may not want to remove _Uninitialzied<T> may be that, we
- // want _Uninitialized<T> to be trivially destructible, no matter whether T
- // is; but we will see.
- template<typename _Type, bool = std::is_literal_type_v<_Type>>
+ // _Uninitialized<T> is guaranteed to be a trivially destructible type,
+ // even if T is not.
+ template<typename _Type, bool = std::is_trivially_destructible_v<_Type>>
struct _Uninitialized;
template<typename _Type>
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
+// <http://www.gnu.org/licenses/>.
+
+#include <variant>
+
+using namespace std;
+
+struct virtual_default_dtor {
+ virtual ~virtual_default_dtor() = default;
+};
+
+void default_ctor()
+{
+ {
+ variant<virtual_default_dtor> 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<variant<int, string>>);
@@ -95,6 +99,9 @@ void default_ctor()
static_assert(noexcept(variant<int>()));
static_assert(!noexcept(variant<Empty>()));
static_assert(noexcept(variant<DefaultNoexcept>()));
+ {
+ variant<virtual_default_dtor> a;
+ }
}
void copy_ctor()
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-07-17 15:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 15:33 [gcc(refs/vendors/ARM/heads/arm-perf-staging)] PR libstdc++/95915 Tamar Christina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).