r270547 - in /trunk/libstdc++-v3: ChangeLog inc...

redi@gcc.gnu.org redi@gcc.gnu.org
Wed Apr 24 15:17:00 GMT 2019


Author: redi
Date: Wed Apr 24 15:17:43 2019
New Revision: 270547

URL: https://gcc.gnu.org/viewcvs?rev=270547&root=gcc&view=rev
Log:
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.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/std/any
    trunk/libstdc++-v3/testsuite/20_util/any/misc/any_cast.cc



More information about the Libstdc++-cvs mailing list