[Bug libstdc++/90220] std::any_cast misbehaves for function and array types
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu May 23 14:18:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90220
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Thu May 23 14:18:13 2019
New Revision: 271558
URL: https://gcc.gnu.org/viewcvs?rev=271558&root=gcc&view=rev
Log:
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.
Modified:
branches/gcc-9-branch/libstdc++-v3/ChangeLog
branches/gcc-9-branch/libstdc++-v3/include/experimental/any
branches/gcc-9-branch/libstdc++-v3/testsuite/experimental/any/misc/any_cast.cc
More information about the Gcc-bugs
mailing list