Commit 985723ce by Jason Merrill Committed by Jason Merrill

re PR c++/6331 (g++ 3.1 looses const qualifiers)

        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.

From-SVN: r52709
parent 12fe8bf2
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.
......
......@@ -585,7 +585,7 @@ do_build_copy_constructor (fndecl)
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);
......
......@@ -5665,10 +5665,11 @@ build_modify_expr (lhs, modifycode, rhs)
{
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;
}
......
// 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());
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment