2002-04-24 Jason Merrill <jason@redhat.com>
+ PR c++/6331
+ * method.c (do_build_copy_constructor): Use cp_build_qualified_type.
+ * typeck.c (build_modify_expr): Allow arrays to differ in cv-quals.
+
PR c++/6395
* decl.c (make_rtl_for_nonlocal_decl): Don't mess with #pragma i/i
stuff for comdats.
continue;
init = build (COMPONENT_REF,
- build_qualified_type (TREE_TYPE (field), cvquals),
+ cp_build_qualified_type (TREE_TYPE (field), cvquals),
init, field);
init = build_tree_list (NULL_TREE, init);
{
int from_array;
- if (!same_or_base_type_p (lhstype, TREE_TYPE (rhs)))
+ if (!same_or_base_type_p (TYPE_MAIN_VARIANT (lhstype),
+ TYPE_MAIN_VARIANT (TREE_TYPE (rhs))))
{
error ("incompatible types in assignment of `%T' to `%T'",
- TREE_TYPE (rhs), lhstype);
+ TREE_TYPE (rhs), lhstype);
return error_mark_node;
}
--- /dev/null
+// PR c++/6331
+// Bug: we were generating a badly cv-qualified ARRAY_TYPE in the
+// synthesized copy constructor for A, which then became the canonical
+// version, confusing later uses.
+
+struct A {
+ virtual ~A();
+ const float* f();
+ float fa[3];
+};
+
+struct B {
+ B(const A& ai) : a (ai) {}
+ A a;
+};
+
+void g (const float pos[3]);
+
+extern A& a;
+void h()
+{
+ g (a.f());
+}