r271562 - in /branches/gcc-8-branch/libstdc++-v...
redi@gcc.gnu.org
redi@gcc.gnu.org
Thu May 23 14:49:00 GMT 2019
Author: redi
Date: Thu May 23 14:49:21 2019
New Revision: 271562
URL: https://gcc.gnu.org/viewcvs?rev=271562&root=gcc&view=rev
Log:
Make any_cast compare typeinfo as well as function pointers
It's possible for the function pointer comparison to fail even though
the type is correct, because the function could be defined multiple
times with different addresses when shared libraries are in use.
Retain the function pointer check for the common case where the check
succeeds, but compare typeinfo (if RTTI is enabled) if the first check
fails.
Backport from mainline
2019-05-23 Jonathan Wakely <jwakely@redhat.com>
* include/experimental/any (__any_caster): Use RTTI if comparing
addresses fails, to support non-unique addresses in shared libraries.
* include/std/any (__any_caster): Likewise.
* testsuite/experimental/any/misc/any_cast_neg.cc: Use 0 for dg-error
line number.
Modified:
branches/gcc-8-branch/libstdc++-v3/ChangeLog
branches/gcc-8-branch/libstdc++-v3/include/experimental/any
branches/gcc-8-branch/libstdc++-v3/include/std/any
branches/gcc-8-branch/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc
More information about the Libstdc++-cvs
mailing list