Commit 12fa82db by Mark Mitchell Committed by Mark Mitchell

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
parent 7afe8c41
2001-02-17 Mark Mitchell <mark@codesourcery.com> 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 * pt.c (check_explicit_specialization): Copy TREE_PRIVATE and
TREE_PROTECTED from the template being specialized. TREE_PROTECTED from the template being specialized.
......
...@@ -2081,8 +2081,8 @@ build_new (placement, decl, init, use_global_new) ...@@ -2081,8 +2081,8 @@ build_new (placement, decl, init, use_global_new)
} }
else else
{ {
int flags = pedantic ? WANT_INT : (WANT_INT | WANT_ENUM); if (build_expr_type_conversion (WANT_INT | WANT_ENUM,
if (build_expr_type_conversion (flags, this_nelts, 0) this_nelts, 0)
== NULL_TREE) == NULL_TREE)
pedwarn ("size in array new must have integral type"); pedwarn ("size in array new must have integral type");
......
...@@ -2152,6 +2152,9 @@ finish_typeof (expr) ...@@ -2152,6 +2152,9 @@ finish_typeof (expr)
return t; return t;
} }
if (TREE_CODE (expr) == OFFSET_REF)
expr = resolve_offset_ref (expr);
return TREE_TYPE (expr); return TREE_TYPE (expr);
} }
......
// 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
};
// Build don't link:
// Origin: j_bouis@hotmail.com
enum { FOO = 3 };
int* arr = new int[FOO];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment