/// is_literal_type
template<typename _Tp>
- struct is_literal_type
+ struct
+ _GLIBCXX17_DEPRECATED
+ is_literal_type
: public integral_constant<bool, __is_literal_type(_Tp)>
{
static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
template <typename _Tp>
_GLIBCXX20_DEPRECATED("use is_standard_layout_v && is_trivial_v instead")
inline constexpr bool is_pod_v = is_pod<_Tp>::value;
-#pragma GCC diagnostic pop
template <typename _Tp>
+ _GLIBCXX17_DEPRECATED
inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
-template <typename _Tp>
+#pragma GCC diagnostic pop
+ template <typename _Tp>
inline constexpr bool is_empty_v = is_empty<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value;
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>
--- /dev/null
+// 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/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++17 } }
+
+#include <type_traits>
+
+static_assert(std::is_literal_type<int>::value); // { dg-warning "is deprecated" }
+static_assert(std::is_literal_type_v<int>); // { dg-warning "is deprecated" }
+
+// { dg-prune-output "declared here" }
+// { dg-additional-options "-Wno-deprecated" { target c++17 } }
// { dg-do compile { target c++11 } }
// 2010-02-21 Paolo Carlini <paolo.carlini@oracle.com>
+// { dg-additional-options "-Wno-deprecated" { target c++17 } }
// { dg-do compile { target c++11 } }
// 2010-02-21 Paolo Carlini <paolo.carlini@oracle.com>
+// { dg-additional-options "-Wno-deprecated" { target c++17 } }
// { dg-do compile { target c++11 } }
// 2010-03-23 Paolo Carlini <paolo.carlini@oracle.com>
// [20.5.6] Disengaged state indicator
static_assert( std::is_same<decltype(std::nullopt), const std::nullopt_t>(), "" );
static_assert( std::is_empty<std::nullopt_t>(), "" );
- static_assert( std::is_literal_type<std::nullopt_t>(), "" );
+ static_assert( __is_literal_type(std::nullopt_t), "" );
static_assert( !std::is_default_constructible<std::nullopt_t>(), "" );
{
// [20.5.6] Disengaged state indicator
static_assert( std::is_same<decltype(std::nullopt), const std::nullopt_t>(), "" );
static_assert( std::is_empty<std::nullopt_t>(), "" );
- static_assert( std::is_literal_type<std::nullopt_t>(), "" );
+ static_assert( __is_literal_type(std::nullopt_t), "" );
static_assert( !std::is_default_constructible<std::nullopt_t>(), "" );
{
static_assert(!is_pod_v<NType>
&& !is_pod<NType>::value, "");
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
static_assert(is_literal_type_v<int>
&& is_literal_type<int>::value, "");
static_assert(!is_literal_type_v<NType>
&& !is_literal_type<NType>::value, "");
+#pragma GCC diagnostic pop
static_assert(is_empty_v<EmptyFinal>
&& is_empty<EmptyFinal>::value, "");
--- /dev/null
+// { 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;
+ }
+}
+
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>>);
static_assert(noexcept(variant<int>()));
static_assert(!noexcept(variant<Empty>()));
static_assert(noexcept(variant<DefaultNoexcept>()));
+ {
+ variant<virtual_default_dtor> a;
+ }
}
void copy_ctor()
// [20.5.6] Disengaged state indicator
static_assert( std::is_same<decltype(std::experimental::nullopt), const std::experimental::nullopt_t>(), "" );
static_assert( std::is_empty<std::experimental::nullopt_t>(), "" );
- static_assert( std::is_literal_type<std::experimental::nullopt_t>(), "" );
+ static_assert( __is_literal_type(std::experimental::nullopt_t), "" );
static_assert( !std::is_default_constructible<std::experimental::nullopt_t>(), "" );
{
// [20.5.6] Disengaged state indicator
static_assert( std::is_same<decltype(std::experimental::nullopt), const std::experimental::nullopt_t>(), "" );
static_assert( std::is_empty<std::experimental::nullopt_t>(), "" );
- static_assert( std::is_literal_type<std::experimental::nullopt_t>(), "" );
+ static_assert( __is_literal_type(std::experimental::nullopt_t), "" );
static_assert( !std::is_default_constructible<std::experimental::nullopt_t>(), "" );
{
static_assert(!is_pod_v<NType>
&& !is_pod<NType>::value, "");
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
static_assert(is_literal_type_v<int>
&& is_literal_type<int>::value, "");
static_assert(!is_literal_type_v<NType>
&& !is_literal_type<NType>::value, "");
+#pragma GCC diagnostic pop
static_assert(is_empty_v<EmptyFinal>
&& is_empty<EmptyFinal>::value, "");
// Generator to test default constructor.
struct constexpr_default_constructible
{
- template<typename _Tp, bool _IsLitp = std::is_literal_type<_Tp>::value>
+ template<typename _Tp, bool _IsLitp = __is_literal_type(_Tp)>
struct _Concept;
// NB: _Tp must be a literal type.
struct constexpr_single_value_constructible
{
template<typename _Ttesttype, typename _Tvaluetype,
- bool _IsLitp = std::is_literal_type<_Ttesttype>::value>
+ bool _IsLitp = __is_literal_type(_Ttesttype)>
struct _Concept;
// NB: _Tvaluetype and _Ttesttype must be literal types.