+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-19 Nathan Sidwell <nathan@codesourcery.com>
* class.c (add_method): Delay adding the slot until the end.
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. */
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;
/* 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 vfields;
#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)
/* 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;
}
+2004-07-18 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/16623
+ * g++.dg/template/assign1.C: New test.
+
2004-07-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/12170
--- /dev/null
+// PR c++/16623
+
+template <int N>
+struct C
+{
+ C& operator= (int);
+};
+
+template <int N>
+C<N>& C<N>::operator= (int)
+{
+ return *this;
+}
+
+C<0> a;