aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2008-08-05 18:22:00 -0400
committerJason Merrill <jason@gcc.gnu.org>2008-08-05 18:22:00 -0400
commit8bd206211ddadcfb501aeed34d137ffd5baee59a (patch)
tree71ca7eb04a3cd8b370ea8d9edf3dc041fb540baf /gcc/tree-ssa.c
parent8a24bf0486b5a23c2772b29ee38e6a8372eaeac1 (diff)
downloadgcc-8bd206211ddadcfb501aeed34d137ffd5baee59a.zip
gcc-8bd206211ddadcfb501aeed34d137ffd5baee59a.tar.gz
gcc-8bd206211ddadcfb501aeed34d137ffd5baee59a.tar.bz2
re PR c++/37016 (member function pointer failure with optimization)
PR c++/37016 * tree-ssa.c (useless_type_conversion_p_1): Call langhook if TYPE_STRUCTURAL_EQUALITY_P is true for both types. From-SVN: r138740
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r--gcc/tree-ssa.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index fbfcbf2..c308a35 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1165,12 +1165,18 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
if (TREE_CODE (inner_type) != TREE_CODE (outer_type))
return false;
- /* ??? Add structural equivalence check. */
+ /* ??? This seems to be necessary even for aggregates that don't
+ have TYPE_STRUCTURAL_EQUALITY_P set. */
/* ??? This should eventually just return false. */
return lang_hooks.types_compatible_p (inner_type, outer_type);
}
-
+ /* Also for functions and possibly other types with
+ TYPE_STRUCTURAL_EQUALITY_P set. */
+ else if (TYPE_STRUCTURAL_EQUALITY_P (inner_type)
+ && TYPE_STRUCTURAL_EQUALITY_P (outer_type))
+ return lang_hooks.types_compatible_p (inner_type, outer_type);
+
return false;
}