]> git.ipfire.org Git - thirdparty/gcc.git/commit - libstdc++-v3/libsupc++/new
PR libstdc++/89345 Only define std::destroying_delete for C++2a
authorJonathan Wakely <jwakely@redhat.com>
Wed, 13 Feb 2019 22:13:45 +0000 (22:13 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 13 Feb 2019 22:13:45 +0000 (22:13 +0000)
commit329c0f891a8e5a18ef8154abca252aeb23585ce2
treed4e97463123b2f8a19b4e0e9a671bbb86c5ecd5e
parent4d259d3bc067f60410f5d249a085ec6d40f2e082
PR libstdc++/89345 Only define std::destroying_delete for C++2a

Clang defines the __cpp_impl_destroying_delete macro unconditionally, so
that the feature is supported whenever the library type is defined. This
is incompatible with the current definition in libstdc++ because we use
constexpr and inline variables, which will give an error for older -std
modes.

This patch defines the destroying_delete_t type and destroying_delete
variable independently of the __cpp_impl_destroying_delete macro, but
only for C++2a (because the names aren't reserved for previous
standards). The __cpp_lib_destroying_delete macro is only defined when
both the library type and compiler macro are defined (i.e. when the type
can actually be used as intended).

PR libstdc++/89345
* include/std/version [__cpp_impl_destroying_delete]
(__cpp_lib_destroying_delete): Only define for C++2a and later.
* libsupc++/new [__cpp_impl_destroying_delete]
(__cpp_lib_destroying_delete): Likewise.
(destroying_delete_t, destroying_delete): Likewise, but define even
when __cpp_impl_destroying_delete is not defined.
* testsuite/18_support/destroying_delete.cc: New test.

From-SVN: r268856
libstdc++-v3/ChangeLog
libstdc++-v3/include/std/version
libstdc++-v3/libsupc++/new
libstdc++-v3/testsuite/18_support/destroying_delete.cc [new file with mode: 0644]