aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-05-12 00:24:33 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2015-05-11 22:24:33 +0000
commit5ce039dfe917d694bef1ecb16844f3b1bcb7ed09 (patch)
treeb27aa77b5c6f68e088a61128b1c06c597c6b36f9 /gcc/cp
parent20d4397af8a085a17925d3a3a3545748d5ab7fc6 (diff)
downloadgcc-5ce039dfe917d694bef1ecb16844f3b1bcb7ed09.zip
gcc-5ce039dfe917d694bef1ecb16844f3b1bcb7ed09.tar.gz
gcc-5ce039dfe917d694bef1ecb16844f3b1bcb7ed09.tar.bz2
class.c (fixup_type_variants): Do not copy TYPE_METHODS
* class.c (fixup_type_variants): Do not copy TYPE_METHODS (one_inheriting_sig): Assert tat we always set TYPE_METHODS of main variant. * semantics.c (finish_member_declaration): Likewise. * method.c (lazily_declare_fn): Allways add method to main variant list. * dwarf2out.c (gen_member_die): Sanity check that we access TYPE_MAIN_VARIANT for TYPE_METHODS. * function.c (use_register_for_decl): Look for TYPE_MAIN_VARIANT when checking TYPE_METHODS. * tree.c (free_lang_data_in_type): See TYPE_METHODS to error_mark_node if non-null. (build_distinct_type_copy): Clear TYPE_METHODS. (verify_type_variant): Verify that TYPE_METHODS is NULL for variants. (verify_type): Allow TYPE_METHODS to be error_mark_node. * tree.def: Update docs of YTPE_STUB_DECL and TYPE_METHODS. From-SVN: r223021
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/method.c2
-rw-r--r--gcc/cp/semantics.c1
4 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fa7a1a0..0bdbf3c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2015-05-11 Jan Hubicka <hubicka@ucw.cz>
+
+ * class.c (fixup_type_variants): Do not copy TYPE_METHODS
+ (one_inheriting_sig): Assert tat we always set TYPE_METHODS of main variant.
+ * semantics.c (finish_member_declaration): Likewise.
+ * method.c (lazily_declare_fn): Allways add method to main variant list.
+
2015-05-09 Aldy Hernandez <aldyh@redhat.com>
PR bootstrap/66085
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index c1548a0..4160705 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1972,7 +1972,6 @@ fixup_type_variants (tree t)
/* Copy whatever these are holding today. */
TYPE_VFIELD (variants) = TYPE_VFIELD (t);
- TYPE_METHODS (variants) = TYPE_METHODS (t);
TYPE_FIELDS (variants) = TYPE_FIELDS (t);
}
}
@@ -3238,6 +3237,7 @@ one_inheriting_sig (tree t, tree ctor, tree *parms, int nparms)
parmlist = tree_cons (NULL_TREE, parms[i], parmlist);
tree fn = implicitly_declare_fn (sfk_inheriting_constructor,
t, false, ctor, parmlist);
+ gcc_assert (TYPE_MAIN_VARIANT (t) == t);
if (add_method (t, fn, NULL_TREE))
{
DECL_CHAIN (fn) = TYPE_METHODS (t);
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 81f50e6..d41e112 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -2139,6 +2139,8 @@ lazily_declare_fn (special_function_kind sfk, tree type)
/* Whether or not the argument has a const reference type. */
bool const_p = false;
+ type = TYPE_MAIN_VARIANT (type);
+
switch (sfk)
{
case sfk_constructor:
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 701a8eb..e1d18fb 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2913,6 +2913,7 @@ finish_member_declaration (tree decl)
CLASSTYPE_METHOD_VEC. */
if (add_method (current_class_type, decl, NULL_TREE))
{
+ gcc_assert (TYPE_MAIN_VARIANT (current_class_type) == current_class_type);
DECL_CHAIN (decl) = TYPE_METHODS (current_class_type);
TYPE_METHODS (current_class_type) = decl;