Commit cc3dc6ea by Nathan Sidwell Committed by Nathan Sidwell

typeck.c (expr_sizeof): Don't decay arrays and functions.

	* typeck.c (expr_sizeof): Don't decay arrays and functions.
	Remove misleading comment.
	(build_compound_expr): Don't decay arrays.

From-SVN: r29378
parent a992ebf6
1999-09-13 Nathan Sidwell <nathan@acm.org>
* typeck.c (expr_sizeof): Don't decay arrays and functions.
Remove misleading comment.
(build_compound_expr): Don't decay arrays.
1999-09-13 Jason Merrill <jason@yorick.cygnus.com>
* call.c (build_conditional_expr): Always use a TARGET_EXPR for
......
......@@ -1600,15 +1600,7 @@ expr_sizeof (e)
if (TREE_CODE (e) == COMPONENT_REF
&& DECL_C_BIT_FIELD (TREE_OPERAND (e, 1)))
error ("sizeof applied to a bit-field");
/* ANSI says arrays and functions are converted inside comma.
But we can't really convert them in build_compound_expr
because that would break commas in lvalues.
So do the conversion here if operand was a comma. */
if (TREE_CODE (e) == COMPOUND_EXPR
&& (TREE_CODE (TREE_TYPE (e)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (e)) == FUNCTION_TYPE))
e = default_conversion (e);
else if (is_overloaded_fn (e))
if (is_overloaded_fn (e))
{
pedwarn ("ANSI C++ forbids taking the sizeof a function type");
return size_int (1);
......@@ -1618,10 +1610,6 @@ expr_sizeof (e)
incomplete_type_error (e, TREE_TYPE (e));
return size_int (1);
}
/* It's illegal to say `sizeof (X::i)' for `i' a non-static data
member unless you're in a non-static member of X. But, we used
to support this usage, so we still permit it unless we're being
pedantic. */
else if (TREE_CODE (e) == OFFSET_REF)
e = resolve_offset_ref (e);
......@@ -5107,10 +5095,6 @@ build_compound_expr (list)
&& TREE_TYPE (list) == TREE_TYPE (TREE_OPERAND (list, 0)))
list = TREE_OPERAND (list, 0);
/* Convert arrays to pointers. */
if (TREE_CODE (TREE_TYPE (TREE_VALUE (list))) == ARRAY_TYPE)
return default_conversion (TREE_VALUE (list));
else
return TREE_VALUE (list);
}
......
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