]> git.ipfire.org Git - thirdparty/gcc.git/commit - libstdc++-v3/ChangeLog
PR libstdc++/90220 Fix std::any_cast for array types
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 24 Apr 2019 15:17:43 +0000 (15:17 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 24 Apr 2019 15:17:43 +0000 (15:17 +0000)
commit37020b0ad7f1269fa5841070e68e1b384f05e1f6
treefa0e6eb0d5e98c5c22274cde7daca42c26449e3c
parent6c58090a2cbf4a1cee1181e7ee0c2ca53e8634e9
PR libstdc++/90220 Fix std::any_cast for array types

Although the std::any constructors use decay_t to determine the type of
the contained value, std::any_cast should use the un-decayed type (and
so always fail for function and array types that decay to pointers).

Using remove_cv_t is correct, because the condition for std::any_cast
to return non-null is operand.type() == typeid(T) and typeid ignores
top-level cv-qualifiers.

PR libstdc++/90220
* include/std/any (__any_caster): Use remove_cv_t instead of decay_t.
Avoid a runtime check for types that can never be stored in std::any.
* testsuite/20_util/any/misc/any_cast.cc: Test std::any_cast with
array types.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@270547 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/std/any
libstdc++-v3/testsuite/20_util/any/misc/any_cast.cc