]> gcc.gnu.org Git - gcc.git/commitdiff
init.c (build_new): Allow enumeration types for the array-bounds in a direct-new...
authorMark Mitchell <mark@codesourcery.com>
Sun, 18 Feb 2001 05:59:45 +0000 (05:59 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 18 Feb 2001 05:59:45 +0000 (05:59 +0000)
* 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

gcc/cp/ChangeLog
gcc/cp/init.c
gcc/cp/semantics.c
gcc/testsuite/g++.old-deja/g++.ext/typeof2.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.other/array4.C [new file with mode: 0644]

index e2de97ab4abbcec302da1ac08fb2b98164f7bd72..99dfb5052f87b2d645d5a4bc0cb38181cf580156 100644 (file)
@@ -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.
 
index fb6beab8850d7ed6cdcdc8e9522a68e19109b177..68139d8d577d798224562333e937aeba87d50e55 100644 (file)
@@ -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");
 
index 9bd7ff71d67f8285de383c5aad4c37b14f4919f3..c186b975ccd7336399475a37a19f03bdf1af7034 100644 (file)
@@ -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 (file)
index 0000000..139048c
--- /dev/null
@@ -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 (file)
index 0000000..797197a
--- /dev/null
@@ -0,0 +1,5 @@
+// Build don't link:
+// Origin: j_bouis@hotmail.com
+
+enum { FOO = 3 };
+int* arr = new int[FOO];
This page took 0.167887 seconds and 5 git commands to generate.