diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-07-20 15:36:08 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2004-07-20 15:36:08 +0000 |
commit | fb2324768037e91dafe1a7c9a3d3907116d7eb37 (patch) | |
tree | 18b5792a881ad5765f15277372efc134e41fc1bc | |
parent | bd65c56456f835eb23e7dcb11fac24c18bdf1133 (diff) | |
download | gcc-fb2324768037e91dafe1a7c9a3d3907116d7eb37.zip gcc-fb2324768037e91dafe1a7c9a3d3907116d7eb37.tar.gz gcc-fb2324768037e91dafe1a7c9a3d3907116d7eb37.tar.bz2 |
re PR c++/16623 (g++ ICE in tsubst_decl:6081)
PR c++/16623
* cp-tree.h (lang_type_class): Add lazy_assignment_op.
(CLASSTYPE_LAZY_ASSIGNMENT_OP): New macro.
* class.c (add_implicitly_declared_members): Use
CLASSTYPE_LAZY_ASSIGNMENT_OP.
* method.c (lazily_declare_fn): Clear
CLASSTYPE_LAZY_ASSIGNMENT_OP.
* search.c (lookup_fnfields_1): Check it.
From-SVN: r84956
-rw-r--r-- | gcc/cp/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/cp/class.c | 6 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 8 | ||||
-rw-r--r-- | gcc/cp/method.c | 2 | ||||
-rw-r--r-- | gcc/cp/search.c | 3 |
5 files changed, 26 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 53406d0..2cf92d0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +2004-07-19 Mark Mitchell <mark@codesourcery.com> + + PR c++/16623 + * cp-tree.h (lang_type_class): Add lazy_assignment_op. + (CLASSTYPE_LAZY_ASSIGNMENT_OP): New macro. + * class.c (add_implicitly_declared_members): Use + CLASSTYPE_LAZY_ASSIGNMENT_OP. + * method.c (lazily_declare_fn): Clear + CLASSTYPE_LAZY_ASSIGNMENT_OP. + * search.c (lookup_fnfields_1): Check it. + 2004-07-20 Nathan Sidwell <nathan@codesourcery.com> * cp-tree.h (vec_binfo_member): Remove. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 169dd91..0274ca9 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -2533,7 +2533,11 @@ add_implicitly_declared_members (tree t, of the parameter to the assignment operator will be a const or non-const reference. */ if (!TYPE_HAS_ASSIGN_REF (t) && !TYPE_FOR_JAVA (t)) - TYPE_HAS_CONST_ASSIGN_REF (t) = !cant_have_const_assignment; + { + TYPE_HAS_ASSIGN_REF (t) = 1; + TYPE_HAS_CONST_ASSIGN_REF (t) = !cant_have_const_assignment; + CLASSTYPE_LAZY_ASSIGNMENT_OP (t) = 1; + } /* Now, hook all of the new functions on to TYPE_METHODS, and add them to the CLASSTYPE_METHOD_VEC. */ diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index a3779d8..097295d 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -987,6 +987,7 @@ struct lang_type_class GTY(()) unsigned lazy_default_ctor : 1; unsigned lazy_copy_ctor : 1; + unsigned lazy_assignment_op : 1; unsigned has_const_init_ref : 1; unsigned has_complex_init_ref : 1; unsigned has_complex_assign_ref : 1; @@ -1000,7 +1001,7 @@ struct lang_type_class GTY(()) /* There are some bits left to fill out a 32-bit word. Keep track of this by updating the size of this bitfield whenever you add or remove a flag. */ - unsigned dummy : 9; + unsigned dummy : 8; tree primary_base; tree vcall_indices; @@ -1094,6 +1095,11 @@ struct lang_type GTY(()) #define CLASSTYPE_LAZY_COPY_CTOR(NODE) \ (LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_ctor) +/* Nonzero means that NODE (a class type) has an assignment operator + -- but that it has not yet been declared. */ +#define CLASSTYPE_LAZY_ASSIGNMENT_OP(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->lazy_assignment_op) + /* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */ #define TYPE_HAS_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_assign_ref) diff --git a/gcc/cp/method.c b/gcc/cp/method.c index a28c901..d2d52bb 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1064,6 +1064,8 @@ lazily_declare_fn (special_function_kind sfk, tree type) /* Create appropriate clones. */ clone_function_decl (fn, /*update_method_vec=*/true); } + else if (sfk == sfk_assignment_operator) + CLASSTYPE_LAZY_ASSIGNMENT_OP (type) = 0; return fn; } diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 364e8f2..63cb639 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1367,8 +1367,7 @@ lookup_fnfields_1 (tree type, tree name) lazily_declare_fn (sfk_copy_constructor, type); } else if (name == ansi_assopname(NOP_EXPR) - && !TYPE_HAS_ASSIGN_REF (type) - && !TYPE_FOR_JAVA (type)) + && CLASSTYPE_LAZY_ASSIGNMENT_OP (type)) lazily_declare_fn (sfk_assignment_operator, type); } |