https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68508
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Thu Nov 26 09:52:48 2015 New Revision: 230928 URL: https://gcc.gnu.org/viewcvs?rev=230928&root=gcc&view=rev Log: PR c++/68508 * cp-tree.h (cp_ubsan_maybe_instrument_downcast): Add INTYPE argument. * cp-ubsan.c (cp_ubsan_maybe_instrument_downcast): Likewise. Use it instead of or in addition to TREE_TYPE (op). Use is_properly_derived_from, return NULL_TREE if TREE_TYPE (intype) and TREE_TYPE (type) are the same type minus qualifiers. * typeck.c (build_static_cast_1): Adjust callers. * g++.dg/ubsan/pr68508.C: New test. Added: trunk/gcc/testsuite/g++.dg/ubsan/pr68508.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-tree.h trunk/gcc/cp/cp-ubsan.c trunk/gcc/cp/typeck.c trunk/gcc/testsuite/ChangeLog