]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR libstdc++/90220 fix experimental::any_cast for non-object types
authorJonathan Wakely <jwakely@redhat.com>
Thu, 23 May 2019 14:18:13 +0000 (15:18 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 23 May 2019 14:18:13 +0000 (15:18 +0100)
commit8e355a1c3b292256605180e55b71296f7c13be6b
tree07a7a3f525ad42e752847e74d8dfed4641f31f69
parentdc172b9806dd22f5eda47a62a0c8b7e6de14e31a
PR libstdc++/90220 fix experimental::any_cast for non-object types

This corresponds to the fixes done for std::any_cast, but has to be done
without if-constexpr. The dummy specialization of _Manager_internal<_Op>
is used to avoid instantiating the real _Manager_internal<T>::_S_manage
function just to compare its address.

Backport from mainline
2019-05-23  Jonathan Wakely  <jwakely@redhat.com>

PR libstdc++/90220
* include/experimental/any (__any_caster): Constrain to only be
callable for object types. Use remove_cv_t instead of decay_t.
If the type decays or isn't copy constructible, compare the manager
function to a dummy specialization.
(__any_caster): Add overload constrained for non-object types.
(any::_Manager_internal<_Op>): Add dummy specialization.
* testsuite/experimental/any/misc/any_cast.cc: Test function types
and array types.

From-SVN: r271558
libstdc++-v3/ChangeLog
libstdc++-v3/include/experimental/any
libstdc++-v3/testsuite/experimental/any/misc/any_cast.cc