From 0abc082acf3728d036fbc3d2fd67a115fa044409 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 3 May 2002 12:22:08 -0400 Subject: [PATCH] tree.c (build_cplus_array_type): Only const and volatile get special handling. * tree.c (build_cplus_array_type): Only const and volatile get special handling. From-SVN: r53098 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/tree.c | 10 ++++++---- gcc/testsuite/g++.dg/template/restrict1.C | 8 ++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/template/restrict1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4e0100ea300..29ced823809 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2002-05-03 Jason Merrill + * tree.c (build_cplus_array_type): Only const and volatile get + special handling. + * decl.c (BOOL_TYPE_SIZE): Move default to defaults.h. 2002-04-30 Mark Mitchell diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index cdf9d7509ba..02d5a4b9028 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -495,14 +495,16 @@ build_cplus_array_type (elt_type, index_type) { 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 (type_quals != TYPE_UNQUALIFIED) - elt_type = cp_build_qualified_type (elt_type, TYPE_UNQUALIFIED); + if (cv_quals) + elt_type = cp_build_qualified_type (elt_type, other_quals); t = build_cplus_array_type_1 (elt_type, index_type); - if (type_quals != TYPE_UNQUALIFIED) - t = cp_build_qualified_type (t, type_quals); + if (cv_quals) + t = cp_build_qualified_type (t, cv_quals); return t; } diff --git a/gcc/testsuite/g++.dg/template/restrict1.C b/gcc/testsuite/g++.dg/template/restrict1.C new file mode 100644 index 00000000000..4452298eb33 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/restrict1.C @@ -0,0 +1,8 @@ +// PR c++/6392 +// Bug: We tried to make the array restricted, which doesn't make sense. + +template +class bob +{ + T * __restrict a[50]; +};