summaryrefslogtreecommitdiffstats
path: root/gcc/cp/typeck2.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-09 08:48:08 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-09 08:48:08 +0000
commit137952923c0102a0ee769bbe849afdf0f59fc8b4 (patch)
tree1246373b84fbf4bb96eed29b458823d826bd18da /gcc/cp/typeck2.c
parente9699b7dbbcc8977775b675c522f3a4fd18a0f07 (diff)
downloadppe42-gcc-137952923c0102a0ee769bbe849afdf0f59fc8b4.tar.gz
ppe42-gcc-137952923c0102a0ee769bbe849afdf0f59fc8b4.zip
* fold-const.c (make_range): Do not access operand 1 for a
zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69130 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/typeck2.c')
-rw-r--r--gcc/cp/typeck2.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index edb9f5d5b21..6a14fecb4a9 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -980,44 +980,48 @@ build_scoped_ref (tree datum, tree basetype, tree* binfo_p)
delegation is detected. */
tree
-build_x_arrow (tree datum)
+build_x_arrow (tree expr)
{
+ tree orig_expr = expr;
tree types_memoized = NULL_TREE;
- register tree rval = datum;
- tree type = TREE_TYPE (rval);
+ tree type = TREE_TYPE (expr);
tree last_rval = NULL_TREE;
if (type == error_mark_node)
return error_mark_node;
if (processing_template_decl)
- return build_min_nt (ARROW_EXPR, rval);
+ {
+ if (type_dependent_expression_p (expr))
+ return build_min_nt (ARROW_EXPR, expr);
+ expr = build_non_dependent_expr (expr);
+ }
if (TREE_CODE (type) == REFERENCE_TYPE)
{
- rval = convert_from_reference (rval);
- type = TREE_TYPE (rval);
+ expr = convert_from_reference (expr);
+ type = TREE_TYPE (expr);
}
if (IS_AGGR_TYPE (type))
{
- while ((rval = build_new_op (COMPONENT_REF, LOOKUP_NORMAL, rval,
+ while ((expr = build_new_op (COMPONENT_REF, LOOKUP_NORMAL, expr,
NULL_TREE, NULL_TREE)))
{
- if (rval == error_mark_node)
+ if (expr == error_mark_node)
return error_mark_node;
- if (value_member (TREE_TYPE (rval), types_memoized))
+ if (value_member (TREE_TYPE (expr), types_memoized))
{
error ("circular pointer delegation detected");
return error_mark_node;
}
else
{
- types_memoized = tree_cons (NULL_TREE, TREE_TYPE (rval),
+ types_memoized = tree_cons (NULL_TREE, TREE_TYPE (expr),
types_memoized);
}
- last_rval = rval;
+ last_rval = expr;
}
if (last_rval == NULL_TREE)
@@ -1030,10 +1034,17 @@ build_x_arrow (tree datum)
last_rval = convert_from_reference (last_rval);
}
else
- last_rval = decay_conversion (rval);
+ last_rval = decay_conversion (expr);
if (TREE_CODE (TREE_TYPE (last_rval)) == POINTER_TYPE)
- return build_indirect_ref (last_rval, NULL);
+ {
+ if (processing_template_decl)
+ return build_min (ARROW_EXPR,
+ TREE_TYPE (TREE_TYPE (last_rval)),
+ orig_expr);
+
+ return build_indirect_ref (last_rval, NULL);
+ }
if (types_memoized)
error ("result of `operator->()' yields non-pointer result");
OpenPOWER on IntegriCloud