This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: c++/6331: g++ 3.1 looses const qualifiers (C++ PATCH)
- From: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
- Date: Wed, 24 Apr 2002 11:46:55 +0100
- Subject: Re: c++/6331: g++ 3.1 looses const qualifiers (C++ PATCH)
- References: <20020424090506.29314.qmail@sources.redhat.com>
Here's a patch for the World.ii bug. We were winding up with a bogus
version of 'const array of float' because we weren't consistently using the
C++-specific build_qualified_type.
Tested i686-pc-linux-gnu, applied trunk and 3.1. Test in
g++.dg/init/array3.C.
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.
*** method.c.~1~ Sat Apr 6 15:33:41 2002
--- method.c Wed Apr 24 09:54:22 2002
*************** do_build_copy_constructor (fndecl)
*** 585,591 ****
continue;
init = build (COMPONENT_REF,
! build_qualified_type (TREE_TYPE (field), cvquals),
init, field);
init = build_tree_list (NULL_TREE, init);
--- 585,591 ----
continue;
init = build (COMPONENT_REF,
! cp_build_qualified_type (TREE_TYPE (field), cvquals),
init, field);
init = build_tree_list (NULL_TREE, init);
*** typeck.c.~1~ Wed Apr 24 01:02:20 2002
--- typeck.c Wed Apr 24 09:56:28 2002
*************** build_modify_expr (lhs, modifycode, rhs)
*** 5665,5674 ****
{
int from_array;
! if (!same_or_base_type_p (lhstype, TREE_TYPE (rhs)))
{
error ("incompatible types in assignment of `%T' to `%T'",
! TREE_TYPE (rhs), lhstype);
return error_mark_node;
}
--- 5665,5675 ----
{
int from_array;
! 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);
return error_mark_node;
}