This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/6392: [PATCH] Problems with __restrict__ type qualifier(array)


This seems like the right fix; there's no reason to apply the bizarre
array cv-qual handling to restrict.

Tested i686-pc-linux-gnu, applied trunk only.  I put Daniel's test in
g++.dg/template/restrict1.C.

2002-05-03  Jason Merrill  <jason@redhat.com>

	* tree.c (build_cplus_array_type): Only const and volatile get
	special handling.

*** tree.c.~1~	Fri May  3 13:15:44 2002
--- tree.c	Thu May  2 17:01:44 2002
*************** build_cplus_array_type (elt_type, index_
*** 495,508 ****
  {
    tree t;
    int type_quals = cp_type_quals (elt_type);
  
!   if (type_quals != TYPE_UNQUALIFIED)
!     elt_type = cp_build_qualified_type (elt_type, TYPE_UNQUALIFIED);
  
    t = build_cplus_array_type_1 (elt_type, index_type);
  
!   if (type_quals != TYPE_UNQUALIFIED)
!     t = cp_build_qualified_type (t, type_quals);
  
    return t;
  }
--- 495,510 ----
  {
    tree t;
    int type_quals = cp_type_quals (elt_type);
+   int cv_quals = type_quals & (TYPE_QUAL_CONST|TYPE_QUAL_VOLATILE);
+   int other_quals = type_quals & ~(TYPE_QUAL_CONST|TYPE_QUAL_VOLATILE);
  
!   if (cv_quals)
!     elt_type = cp_build_qualified_type (elt_type, other_quals);
  
    t = build_cplus_array_type_1 (elt_type, index_type);
  
!   if (cv_quals)
!     t = cp_build_qualified_type (t, cv_quals);
  
    return t;
  }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]