diff options
author | Mark Mitchell <mark@codesourcery.com> | 2001-02-18 05:59:45 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2001-02-18 05:59:45 +0000 |
commit | 12fa82db7dcdad8d8fbe5a582216bd2b3667d529 (patch) | |
tree | cd5f8c6c3cf53abb223c76d5f99be70b621c9371 | |
parent | 7afe8c419bb43051d7b9aa8a5be0de2c1bd83bfc (diff) | |
download | gcc-12fa82db7dcdad8d8fbe5a582216bd2b3667d529.zip gcc-12fa82db7dcdad8d8fbe5a582216bd2b3667d529.tar.gz gcc-12fa82db7dcdad8d8fbe5a582216bd2b3667d529.tar.bz2 |
init.c (build_new): Allow enumeration types for the array-bounds in a direct-new-declarator.
* init.c (build_new): Allow enumeration types for the array-bounds
in a direct-new-declarator.
* semantics.c (finish_typeof): Resolve OFFSET_REFs.
From-SVN: r39817
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/init.c | 4 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.ext/typeof2.C | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/array4.C | 5 |
5 files changed, 23 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e2de97a..99dfb50 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2001-02-17 Mark Mitchell <mark@codesourcery.com> + * init.c (build_new): Allow enumeration types for the array-bounds + in a direct-new-declarator. + + * semantics.c (finish_typeof): Resolve OFFSET_REFs. + * pt.c (check_explicit_specialization): Copy TREE_PRIVATE and TREE_PROTECTED from the template being specialized. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index fb6beab..68139d8 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2081,8 +2081,8 @@ build_new (placement, decl, init, use_global_new) } else { - int flags = pedantic ? WANT_INT : (WANT_INT | WANT_ENUM); - if (build_expr_type_conversion (flags, this_nelts, 0) + if (build_expr_type_conversion (WANT_INT | WANT_ENUM, + this_nelts, 0) == NULL_TREE) pedwarn ("size in array new must have integral type"); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 9bd7ff7..c186b97 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2152,6 +2152,9 @@ finish_typeof (expr) return t; } + if (TREE_CODE (expr) == OFFSET_REF) + expr = resolve_offset_ref (expr); + return TREE_TYPE (expr); } diff --git a/gcc/testsuite/g++.old-deja/g++.ext/typeof2.C b/gcc/testsuite/g++.old-deja/g++.ext/typeof2.C new file mode 100644 index 0000000..139048c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/typeof2.C @@ -0,0 +1,8 @@ +// Build don't link: +// Origin: Mark Mitchell <mark@codesourcery.com> + +struct S +{ + int i; // ERROR - non-static data member + __typeof( S::i ) f (); // ERROR - referenced here +}; diff --git a/gcc/testsuite/g++.old-deja/g++.other/array4.C b/gcc/testsuite/g++.old-deja/g++.other/array4.C new file mode 100644 index 0000000..797197a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/array4.C @@ -0,0 +1,5 @@ +// Build don't link: +// Origin: j_bouis@hotmail.com + +enum { FOO = 3 }; +int* arr = new int[FOO]; |