summaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-11 14:36:05 +0000
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-11 14:36:05 +0000
commitd7f79c8890d12b5ac37f59b9e5171ca6f4fe3b41 (patch)
treefcebb61777e39028dfd13660e12098519b9ca084 /gcc/cp/tree.c
parent62ed126e6a4f6b95a0986b8ae5db9cee9f32a83b (diff)
downloadgcc-d7f79c8890d12b5ac37f59b9e5171ca6f4fe3b41.tar.gz
Fix PR c++/42225
gcc/cp/ChangeLog: PR c++/42225 * typeck.c (incompatible_dependent_typedefs_p): New function. (structural_comptypes): Use it. * cp-tree.h (cp_set_underlying_type): Declare ... * tree.c (cp_set_underlying_type): ... new function. * class.c (build_self_reference): Use cp_set_underlying_type instead of set_underlying_type. * decl2.c (grokfield): Likewise. * name-lookup.c (pushdecl_maybe_friend): Likewise. gcc/testsuite/ChangeLog: PR c++/42225 * g++.dg/template/typedef24.C: New test. * g++.dg/template/typedef25.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155160 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 17fc495c9a3..7097f8c68b6 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1076,6 +1076,22 @@ typedef_variant_p (tree type)
return is_typedef_decl (TYPE_NAME (type));
}
+/* Setup a TYPE_DECL node as a typedef representation.
+ See comments of set_underlying_type in c-common.c. */
+
+void
+cp_set_underlying_type (tree t)
+{
+ set_underlying_type (t);
+ /* If the typedef variant type is dependent, make it require
+ structural equality.
+ This is useful when comparing two dependent typedef variant types,
+ because it forces the comparison of the template parameters of their
+ decls for instance. */
+ if (dependent_type_p (TREE_TYPE (t)))
+ SET_TYPE_STRUCTURAL_EQUALITY (TREE_TYPE (t));
+}
+
/* Makes a copy of BINFO and TYPE, which is to be inherited into a
graph dominated by T. If BINFO is NULL, TYPE is a dependent base,