From: Mark Mitchell Date: Sun, 18 Feb 2001 05:59:45 +0000 (+0000) Subject: init.c (build_new): Allow enumeration types for the array-bounds in a direct-new... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=12fa82db7dcdad8d8fbe5a582216bd2b3667d529;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e2de97ab4ab..99dfb5052f8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2001-02-17 Mark Mitchell + * 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 fb6beab8850..68139d8d577 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 9bd7ff71d67..c186b975ccd 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 00000000000..139048c4128 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/typeof2.C @@ -0,0 +1,8 @@ +// Build don't link: +// Origin: Mark Mitchell + +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 00000000000..797197a42d6 --- /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];