mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-10 05:50:28 +08:00
libstdc++: Implementing P0767 - deprecate POD
This adds the deprecated attribute to std::is_pod and std::is_pod_v for C++20. 2019-12-05 JeanHeyd "ThePhD" Meneide <phdofthehouse@gmail.com> * include/bits/c++config (_GLIBCXX20_DEPRECATED): Add new macro. * include/std/type_traits (is_pod, is_pod_v): Deprecate for C++20. * testuite/20_util/is_pod/deprecated-2a.cc: New test. From-SVN: r280065
This commit is contained in:
parent
ab3a095c4b
commit
1a6c5064f9
@ -1,3 +1,9 @@
|
||||
2020-01-09 JeanHeyd "ThePhD" Meneide <phdofthehouse@gmail.com>
|
||||
|
||||
* include/bits/c++config (_GLIBCXX20_DEPRECATED): Add new macro.
|
||||
* include/std/type_traits (is_pod, is_pod_v): Deprecate for C++20.
|
||||
* testuite/20_util/is_pod/deprecated-2a.cc: New test.
|
||||
|
||||
2020-01-09 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
PR libstdc++/93205
|
||||
|
@ -78,6 +78,7 @@
|
||||
// _GLIBCXX_USE_DEPRECATED
|
||||
// _GLIBCXX_DEPRECATED
|
||||
// _GLIBCXX17_DEPRECATED
|
||||
// _GLIBCXX20_DEPRECATED( string-literal )
|
||||
#ifndef _GLIBCXX_USE_DEPRECATED
|
||||
# define _GLIBCXX_USE_DEPRECATED 1
|
||||
#endif
|
||||
@ -94,6 +95,12 @@
|
||||
# define _GLIBCXX17_DEPRECATED
|
||||
#endif
|
||||
|
||||
#if defined(__DEPRECATED) && (__cplusplus > 201703L)
|
||||
# define _GLIBCXX20_DEPRECATED(MSG) [[deprecated(MSG)]]
|
||||
#else
|
||||
# define _GLIBCXX20_DEPRECATED(MSG)
|
||||
#endif
|
||||
|
||||
// Macros for ABI tag attributes.
|
||||
#ifndef _GLIBCXX_ABI_TAG_CXX11
|
||||
# define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11")))
|
||||
|
@ -685,10 +685,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
"template argument must be a complete class or an unbounded array");
|
||||
};
|
||||
|
||||
/// is_pod
|
||||
/// is_pod (deprecated in C++20)
|
||||
// Could use is_standard_layout && is_trivial instead of the builtin.
|
||||
template<typename _Tp>
|
||||
struct is_pod
|
||||
struct
|
||||
_GLIBCXX20_DEPRECATED("use is_standard_layout && is_trivial instead")
|
||||
is_pod
|
||||
: public integral_constant<bool, __is_pod(_Tp)>
|
||||
{
|
||||
static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
|
||||
@ -3078,6 +3080,7 @@ template <typename _Tp>
|
||||
template <typename _Tp>
|
||||
inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
_GLIBCXX20_DEPRECATED("use is_standard_layout_v && is_trivial_v instead")
|
||||
inline constexpr bool is_pod_v = is_pod<_Tp>::value;
|
||||
template <typename _Tp>
|
||||
inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
|
||||
|
26
libstdc++-v3/testsuite/20_util/is_pod/deprecated-2a.cc
Normal file
26
libstdc++-v3/testsuite/20_util/is_pod/deprecated-2a.cc
Normal file
@ -0,0 +1,26 @@
|
||||
// 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++2a" }
|
||||
// { dg-do compile { target c++2a } }
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
static_assert(std::is_pod<int>::value); // { dg-warning "is deprecated" }
|
||||
static_assert(std::is_pod_v<int>); // { dg-warning "is deprecated" }
|
||||
|
||||
// { dg-prune-output "declared here" }
|
Loading…
x
Reference in New Issue
Block a user