summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gcc/cp')
-rw-r--r--contrib/gcc/cp/ChangeLog179
-rw-r--r--contrib/gcc/cp/call.c105
-rw-r--r--contrib/gcc/cp/class.c47
-rw-r--r--contrib/gcc/cp/cp-tree.h12
-rw-r--r--contrib/gcc/cp/decl.c81
-rw-r--r--contrib/gcc/cp/decl2.c2
-rw-r--r--contrib/gcc/cp/friend.c2
-rw-r--r--contrib/gcc/cp/init.c4
-rw-r--r--contrib/gcc/cp/pt.c51
-rw-r--r--contrib/gcc/cp/search.c23
-rw-r--r--contrib/gcc/cp/tree.c99
-rw-r--r--contrib/gcc/cp/typeck.c94
-rw-r--r--contrib/gcc/cp/typeck2.c3
13 files changed, 453 insertions, 249 deletions
diff --git a/contrib/gcc/cp/ChangeLog b/contrib/gcc/cp/ChangeLog
index 854fefa..e05c075 100644
--- a/contrib/gcc/cp/ChangeLog
+++ b/contrib/gcc/cp/ChangeLog
@@ -1,6 +1,181 @@
-2003-08-04 Release Manager
+2003-10-23 Jason Merrill <jason@redhat.com>
- * GCC 3.3.1 Released.
+ PR c++/12726
+ * tree.c (build_target_expr_with_type): Don't call force_rvalue
+ for CONSTRUCTORs.
+
+2003-10-16 Release Manager
+
+ * GCC 3.3.2 Released.
+
+2003-10-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/12369
+ * decl.c (grokdeclarator): Handle TEMPLATE_ID_EXPR if friend
+ is a member of other class.
+ * friend.c (do_friend): Don't build TEMPLATE_DECL if friend
+ is a specialization of function template.
+
+2003-10-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/7939
+ * typeck.c (comptypes): Don't ICE when its first argument is
+ error_mark_node.
+ (compparms): Reverse the arguments of same_type_p.
+
+2003-10-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/11878
+ * tree.c (build_target_expr_with_type): Call force_rvalue for
+ classes with non-trivial copy ctors.
+
+ PR c++/11063
+ * typeck.c (build_modify_expr): Call convert rather than abort.
+
+2003-10-06 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10147
+ * call.c (initialize_reference): Tweak error message.
+
+ PR c++/12337
+ * init.c (build_new_1): Make sure that the expression returned is
+ not an lvalue.
+
+ PR c++/12344, c++/12236, c++/8656
+ * decl.c (start_function): Do not ignore attributes embedded in a
+ function declarator.
+
+2003-10-04 Roger Sayle <roger@eyesopen.com>
+
+ PR c++/11409
+ * class.c (resolve_address_of_overloaded_function): When building
+ list of matching non-template function decls, ignore anticipated
+ declarations of undeclared or shadowed GCC builtins.
+
+2003-10-02 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12486
+ * typeck.c (finish_class_member_access_expr): Issue diagnostic
+ on erroneous use of qualified name.
+
+2003-07-09 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (break_out_calls): Remove declaration.
+ * tree.c (break_out_calls): Remove.
+ * typeck.c (build_modify_expr): Avoid invalid sharing of trees.
+
+2003-09-18 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (resolve_address_of_overloaded_function): Replace
+ complain parameter with flags parameter.
+ (instantiate_type): Adjust accordingly.
+
+2003-09-17 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11991
+ * typeck2.c (incomplete_type_diagnostic): Robustify.
+
+ PR c++/12266
+ * cp-tree.h (tsubst_flags_t): Add tf_conv.
+ * class.c (standard_conversion): Pass tf_conv to
+ instantiate_type.
+ (resolve_address_of_overloaded_function): Do not call mark_used
+ when just checking conversions.
+
+2003-09-14 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/3907
+ * cp-tree.h (innermost_scope_is_class_p): New function.
+ * class.c (maybe_note_name_used_in_class): Refine test for whether
+ or not we are in a class scope.
+ * decl.c (innermost_scope_is_class_p): Define.
+
+2003-09-14 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (layout_class_type): Make DECL_MODE match TYPE_MODE for
+ an bit-field whose width exceeds that of its type.
+
+2003-09-09 Steven Bosscher <steven@gcc.gnu.org>
+
+ PR c++/11595
+ * decl.c (define_label): Remove unreachable timevar pop.
+ Always return the decl, even if the definition is invalid.
+
+2003-09-08 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11786
+ * decl2.c (add_function): Do not complain about seeing the same
+ non-function twice.
+
+2003-09-08 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/5296
+ * pt.c (try_one_overload): Add addr_p parameter.
+ (resolve_overloaded_unification): Pass it.
+
+2003-09-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/12181
+ * typeck.c (build_modify_expr): Don't always stabilize the lhs and
+ rhs. Do stabilize the lhs of a MODIFY_EXPR used on the lhs.
+
+2003-09-06 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11867
+ * call.c (standard_conversion): Improve comments.
+ (perform_direct_initialization): Make sure we return an expression
+ of the correct type.
+ * typeck.c (build_static_cast): Check for ambiguity and
+ accessibility when performing conversions.
+
+2003-09-05 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12163
+ * call.c (perform_direct_initialization): Correct logic for
+ direct-initialization of a class type.
+
+ PR c++/12146
+ * pt.c (lookup_template_function): Robustify.
+
+2003-09-04 Mark Mitchell <mark@codesourcery.com>
+
+ Revert this patch:
+ * class.c (include_empty_classes): Correct logic for ABI version 1.
+
+2003-09-03 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12053
+ * class.c (include_empty_classes): Correct logic for ABI version 1.
+
+2003-09-01 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12114
+ * cp-tree.h (initialize_reference): Change prototype.
+ * call.c (initialize_reference): Add cleanup parameter.
+ * decl.c (grok_reference_init): Likewise.
+ (check_initializer): Likewise.
+ (cp_finish_decl): Insert a CLEANUP_STMT if necessary.
+ (duplicate_decls): When replacing an anticipated builtin, do not
+ honor TREE_NOTHROW.
+ * typeck.c (convert_for_initialization): Correct call to
+ initialize_reference.
+
+2003-08-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/11928
+ * search.c (add_conversions): Avoid adding two conversion
+ operators for the same type.
+
+2003-08-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h (build_function_call_real): Remove unused parameter.
+ * typeck.c (build_function_call_real): Likewise. Caller changed.
+ * decl.c (binding_table_reverse_maybe_remap): Initialize variable.
+
+2003-08-19 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/5293
+ * call.c (initialize_reference): Improve diagnostic.
2003-08-04 Release Manager
diff --git a/contrib/gcc/cp/call.c b/contrib/gcc/cp/call.c
index 8750128..1a1a493 100644
--- a/contrib/gcc/cp/call.c
+++ b/contrib/gcc/cp/call.c
@@ -756,7 +756,7 @@ standard_conversion (to, from, expr)
if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to))
&& expr && type_unknown_p (expr))
{
- expr = instantiate_type (to, expr, tf_none);
+ expr = instantiate_type (to, expr, tf_conv);
if (expr == error_mark_node)
return NULL_TREE;
from = TREE_TYPE (expr);
@@ -857,16 +857,25 @@ standard_conversion (to, from, expr)
}
}
else if (IS_AGGR_TYPE (TREE_TYPE (from))
- && IS_AGGR_TYPE (TREE_TYPE (to)))
+ && IS_AGGR_TYPE (TREE_TYPE (to))
+ /* [conv.ptr]
+
+ An rvalue of type "pointer to cv D," where D is a
+ class type, can be converted to an rvalue of type
+ "pointer to cv B," where B is a base class (clause
+ _class.derived_) of D. If B is an inaccessible
+ (clause _class.access_) or ambiguous
+ (_class.member.lookup_) base class of D, a program
+ that necessitates this conversion is ill-formed. */
+ /* Therefore, we use DERIVED_FROM_P, and not
+ ACESSIBLY_UNIQUELY_DERIVED_FROM_P, in this test. */
+ && DERIVED_FROM_P (TREE_TYPE (to), TREE_TYPE (from)))
{
- if (DERIVED_FROM_P (TREE_TYPE (to), TREE_TYPE (from)))
- {
- from =
- cp_build_qualified_type (TREE_TYPE (to),
- cp_type_quals (TREE_TYPE (from)));
- from = build_pointer_type (from);
- conv = build_conv (PTR_CONV, from, conv);
- }
+ from =
+ cp_build_qualified_type (TREE_TYPE (to),
+ cp_type_quals (TREE_TYPE (from)));
+ from = build_pointer_type (from);
+ conv = build_conv (PTR_CONV, from, conv);
}
if (same_type_p (from, to))
@@ -5993,7 +6002,8 @@ perform_implicit_conversion (type, expr)
/* Convert EXPR to TYPE (as a direct-initialization) if that is
permitted. If the conversion is valid, the converted expression is
- returned. Otherwise, NULL_TREE is returned. */
+ returned. Otherwise, NULL_TREE is returned, except in the case
+ that TYPE is a class type; in that case, an error is issued. */
tree
perform_direct_initialization_if_possible (tree type, tree expr)
@@ -6002,6 +6012,22 @@ perform_direct_initialization_if_possible (tree type, tree expr)
if (type == error_mark_node || error_operand_p (expr))
return error_mark_node;
+ /* [dcl.init]
+
+ If the destination type is a (possibly cv-qualified) class type:
+
+ -- If the initialization is direct-initialization ...,
+ constructors are considered. ... If no constructor applies, or
+ the overload resolution is ambiguous, the initialization is
+ ill-formed. */
+ if (CLASS_TYPE_P (type))
+ {
+ expr = build_special_member_call (NULL_TREE, complete_ctor_identifier,
+ build_tree_list (NULL_TREE, expr),
+ TYPE_BINFO (type),
+ LOOKUP_NORMAL);
+ return build_cplus_new (type, expr);
+ }
conv = implicit_conversion (type, TREE_TYPE (expr), expr,
LOOKUP_NORMAL);
if (!conv || ICS_BAD_FLAG (conv))
@@ -6048,18 +6074,23 @@ make_temporary_var_for_ref_to_temp (tree decl, tree type)
return var;
}
-/* Convert EXPR to the indicated reference TYPE, in a way suitable for
- initializing a variable of that TYPE. If DECL is non-NULL, it is
- the VAR_DECL being initialized with the EXPR. (In that case, the
- type of DECL will be TYPE.)
+ /* Convert EXPR to the indicated reference TYPE, in a way suitable
+ for initializing a variable of that TYPE. If DECL is non-NULL,
+ it is the VAR_DECL being initialized with the EXPR. (In that
+ case, the type of DECL will be TYPE.) If DECL is non-NULL, then
+ CLEANUP must also be non-NULL, and with *CLEANUP initialized to
+ NULL. Upon return, if *CLEANUP is no longer NULL, it will be a
+ CLEANUP_STMT that should be inserted after the returned
+ expression is used to initialize DECL.
- Return the converted expression. */
+ Return the converted expression. */
tree
-initialize_reference (type, expr, decl)
+initialize_reference (type, expr, decl, cleanup)
tree type;
tree expr;
tree decl;
+ tree *cleanup;
{
tree conv;
@@ -6069,7 +6100,15 @@ initialize_reference (type, expr, decl)
conv = reference_binding (type, TREE_TYPE (expr), expr, LOOKUP_NORMAL);
if (!conv || ICS_BAD_FLAG (conv))
{
- error ("could not convert `%E' to `%T'", expr, type);
+ if (!(TYPE_QUALS (TREE_TYPE (type)) & TYPE_QUAL_CONST)
+ && !real_lvalue_p (expr))
+ error ("invalid initialization of non-const reference of "
+ "type '%T' from a temporary of type '%T'",
+ type, TREE_TYPE (expr));
+ else
+ error ("invalid initialization of reference of type "
+ "'%T' from expression of type '%T'", type,
+ TREE_TYPE (expr));
return error_mark_node;
}
@@ -6135,14 +6174,33 @@ initialize_reference (type, expr, decl)
type = TREE_TYPE (expr);
var = make_temporary_var_for_ref_to_temp (decl, type);
layout_decl (var, 0);
+ /* Create the INIT_EXPR that will initialize the temporary
+ variable. */
+ init = build (INIT_EXPR, type, var, expr);
if (at_function_scope_p ())
{
- tree cleanup;
-
add_decl_stmt (var);
- cleanup = cxx_maybe_build_cleanup (var);
- if (cleanup)
- finish_decl_cleanup (var, cleanup);
+ *cleanup = cxx_maybe_build_cleanup (var);
+ if (*cleanup)
+ /* We must be careful to destroy the temporary only
+ after its initialization has taken place. If the
+ initialization throws an exception, then the
+ destructor should not be run. We cannot simply
+ transform INIT into something like:
+
+ (INIT, ({ CLEANUP_STMT; }))
+
+ because emit_local_var always treats the
+ initializer as a full-expression. Thus, the
+ destructor would run too early; it would run at the
+ end of initializing the reference variable, rather
+ than at the end of the block enclosing the
+ reference variable.
+
+ The solution is to pass back a CLEANUP_STMT which
+ the caller is responsible for attaching to the
+ statement tree. */
+ *cleanup = build_stmt (CLEANUP_STMT, var, *cleanup);
}
else
{
@@ -6151,7 +6209,6 @@ initialize_reference (type, expr, decl)
static_aggregates = tree_cons (NULL_TREE, var,
static_aggregates);
}
- init = build (INIT_EXPR, type, var, expr);
/* Use its address to initialize the reference variable. */
expr = build_address (var);
expr = build (COMPOUND_EXPR, TREE_TYPE (expr), init, expr);
diff --git a/contrib/gcc/cp/class.c b/contrib/gcc/cp/class.c
index c1da654..f6e0396 100644
--- a/contrib/gcc/cp/class.c
+++ b/contrib/gcc/cp/class.c
@@ -127,8 +127,9 @@ static int field_decl_cmp PARAMS ((const tree *, const tree *));
static int method_name_cmp PARAMS ((const tree *, const tree *));
static void add_implicitly_declared_members PARAMS ((tree, int, int, int));
static tree fixed_type_or_null PARAMS ((tree, int *, int *));
-static tree resolve_address_of_overloaded_function PARAMS ((tree, tree, int,
- int, int, tree));
+static tree resolve_address_of_overloaded_function PARAMS ((tree, tree,
+ tsubst_flags_t,
+ int, int, tree));
static tree build_vtable_entry_ref PARAMS ((tree, tree, tree));
static tree build_vtbl_ref_1 PARAMS ((tree, tree));
static tree build_vtbl_initializer PARAMS ((tree, tree, tree, tree, int *));
@@ -5042,6 +5043,15 @@ layout_class_type (tree t, tree *virtuals_p)
field to the size of its declared type; the rest of the
field is effectively invisible. */
DECL_SIZE (field) = TYPE_SIZE (type);
+ /* We must also reset the DECL_MODE of the field. */
+ if (abi_version_at_least (2))
+ DECL_MODE (field) = TYPE_MODE (type);
+ else if (warn_abi
+ && DECL_MODE (field) != TYPE_MODE (type))
+ /* Versions of G++ before G++ 3.4 did not reset the
+ DECL_MODE. */
+ warning ("the offset of `%D' may not be ABI-compliant and may "
+ "change in a future version of GCC", field);
}
else
{
@@ -5994,13 +6004,13 @@ pop_lang_context ()
static tree
resolve_address_of_overloaded_function (target_type,
overload,
- complain,
+ flags,
ptrmem,
template_only,
explicit_targs)
tree target_type;
tree overload;
- int complain;
+ tsubst_flags_t flags;
int ptrmem;
int template_only;
tree explicit_targs;
@@ -6064,7 +6074,7 @@ resolve_address_of_overloaded_function (target_type,
}
else
{
- if (complain)
+ if (flags & tf_error)
error ("\
cannot resolve overloaded function `%D' based on conversion to type `%T'",
DECL_NAME (OVL_FUNCTION (overload)), target_type);
@@ -6093,7 +6103,11 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'",
/* We're looking for a non-static member, and this isn't
one, or vice versa. */
continue;
-
+
+ /* Ignore anticipated decls of undeclared builtins. */
+ if (DECL_ANTICIPATED (fn))
+ continue;
+
/* See if there's a match. */
fntype = TREE_TYPE (fn);
if (is_ptrmem)
@@ -6184,7 +6198,7 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'",
if (matches == NULL_TREE)
{
/* There were *no* matches. */
- if (complain)
+ if (flags & tf_error)
{
error ("no matches converting function `%D' to type `%#T'",
DECL_NAME (OVL_FUNCTION (overload)),
@@ -6205,7 +6219,7 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'",
{
/* There were too many matches. */
- if (complain)
+ if (flags & tf_error)
{
tree match;
@@ -6232,7 +6246,7 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'",
{
static int explained;
- if (!complain)
+ if (!(flags & tf_error))
return error_mark_node;
pedwarn ("assuming pointer to member `%D'", fn);
@@ -6242,7 +6256,13 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'",
explained = 1;
}
}
- mark_used (fn);
+
+ /* If we're doing overload resolution purely for the purpose of
+ determining conversion sequences, we should not consider the
+ function used. If this conversion sequence is selected, the
+ function will be marked as used at this point. */
+ if (!(flags & tf_conv))
+ mark_used (fn);
if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type))
return build_unary_op (ADDR_EXPR, fn, 0);
@@ -6272,6 +6292,7 @@ instantiate_type (lhstype, rhs, flags)
tree lhstype, rhs;
tsubst_flags_t flags;
{
+ tsubst_flags_t flags_in = flags;
int complain = (flags & tf_error);
int strict = (flags & tf_no_attributes)
? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT;
@@ -6362,7 +6383,7 @@ instantiate_type (lhstype, rhs, flags)
return
resolve_address_of_overloaded_function (lhstype,
fns,
- complain,
+ flags_in,
allow_ptrmem,
/*template_only=*/1,
args);
@@ -6372,7 +6393,7 @@ instantiate_type (lhstype, rhs, flags)
return
resolve_address_of_overloaded_function (lhstype,
rhs,
- complain,
+ flags_in,
allow_ptrmem,
/*template_only=*/0,
/*explicit_targs=*/NULL_TREE);
@@ -6678,7 +6699,7 @@ maybe_note_name_used_in_class (name, decl)
splay_tree names_used;
/* If we're not defining a class, there's nothing to do. */
- if (!current_class_type || !TYPE_BEING_DEFINED (current_class_type))
+ if (!innermost_scope_is_class_p ())
return;
/* If there's already a binding for this NAME, then we don't have
diff --git a/contrib/gcc/cp/cp-tree.h b/contrib/gcc/cp/cp-tree.h
index 9b529a8..493206d 100644
--- a/contrib/gcc/cp/cp-tree.h
+++ b/contrib/gcc/cp/cp-tree.h
@@ -3149,8 +3149,12 @@ typedef enum tsubst_flags_t {
(make_typename_type use) */
tf_ptrmem_ok = 1 << 5, /* pointers to member ok (internal
instantiate_type use) */
- tf_parsing = 1 << 6 /* called from parser
+ tf_parsing = 1 << 6, /* called from parser
(make_typename_type use) */
+ tf_conv = 1 << 8, /* We are determining what kind of
+ conversion might be permissible, not
+ actually performing the
+ conversion. */
} tsubst_flags_t;
/* The kind of checking we can do looking in a class hierarchy. */
@@ -3623,7 +3627,7 @@ extern tree type_passed_as PARAMS ((tree));
extern tree convert_for_arg_passing PARAMS ((tree, tree));
extern tree cp_convert_parm_for_inlining PARAMS ((tree, tree, tree));
extern int is_properly_derived_from PARAMS ((tree, tree));
-extern tree initialize_reference PARAMS ((tree, tree, tree));
+extern tree initialize_reference PARAMS ((tree, tree, tree, tree *));
extern tree make_temporary_var_for_ref_to_temp (tree, tree);
extern tree strip_top_quals PARAMS ((tree));
extern tree perform_implicit_conversion PARAMS ((tree, tree));
@@ -3696,6 +3700,7 @@ extern void adjust_clone_args PARAMS ((tree));
/* decl.c */
extern int global_bindings_p PARAMS ((void));
extern int kept_level_p PARAMS ((void));
+extern bool innermost_scope_is_class_p (void);
extern tree getdecls PARAMS ((void));
extern void pushlevel PARAMS ((int));
extern tree poplevel PARAMS ((int,int, int));
@@ -4312,7 +4317,6 @@ extern tree build_min PARAMS ((enum tree_code, tree,
extern tree build_min_nt PARAMS ((enum tree_code, ...));
extern tree build_cplus_new PARAMS ((tree, tree));
extern tree get_target_expr PARAMS ((tree));
-extern tree break_out_calls PARAMS ((tree));
extern tree build_cplus_method_type PARAMS ((tree, tree, tree));
extern tree build_cplus_staticfn_type PARAMS ((tree, tree, tree));
extern tree build_cplus_array_type PARAMS ((tree, tree));
@@ -4405,7 +4409,7 @@ extern tree build_x_indirect_ref PARAMS ((tree, const char *));
extern tree build_indirect_ref PARAMS ((tree, const char *));
extern tree build_array_ref PARAMS ((tree, tree));
extern tree get_member_function_from_ptrfunc PARAMS ((tree *, tree));
-extern tree build_function_call_real PARAMS ((tree, tree, int, int));
+extern tree build_function_call_real PARAMS ((tree, tree, int));
extern tree build_function_call_maybe PARAMS ((tree, tree));
extern tree convert_arguments PARAMS ((tree, tree, tree, int));
extern tree build_x_binary_op PARAMS ((enum tree_code, tree, tree));
diff --git a/contrib/gcc/cp/decl.c b/contrib/gcc/cp/decl.c
index a392ee0..03b9008 100644
--- a/contrib/gcc/cp/decl.c
+++ b/contrib/gcc/cp/decl.c
@@ -72,7 +72,7 @@ static tree lookup_tag_reverse PARAMS ((tree, tree));
static tree lookup_name_real PARAMS ((tree, int, int, int));
static void push_local_name PARAMS ((tree));
static void warn_extern_redeclared_static PARAMS ((tree, tree));
-static tree grok_reference_init PARAMS ((tree, tree, tree));
+static tree grok_reference_init PARAMS ((tree, tree, tree, tree *));
static tree grokfndecl PARAMS ((tree, tree, tree, tree, int,
enum overload_flags, tree,
tree, int, int, int, int, int, int, tree));
@@ -123,7 +123,7 @@ static void pop_labels PARAMS ((tree));
static void maybe_deduce_size_from_array_init PARAMS ((tree, tree));
static void layout_var_decl PARAMS ((tree));
static void maybe_commonize_var PARAMS ((tree));
-static tree check_initializer (tree, tree, int);
+static tree check_initializer (tree, tree, int, tree *);
static void make_rtl_for_nonlocal_decl PARAMS ((tree, tree, const char *));
static void save_function_data PARAMS ((tree));
static void check_function_type PARAMS ((tree, tree));
@@ -461,7 +461,7 @@ binding_table_reverse_maybe_remap (binding_table table, tree type, tree name)
{
const size_t chain_count = table->chain_count;
binding_entry entry = NULL;
- binding_entry *p;
+ binding_entry *p = NULL;
size_t i;
for (i = 0; i < chain_count && entry == NULL; ++i)
@@ -922,6 +922,14 @@ kept_level_p ()
&& !current_binding_level->tag_transparent));
}
+/* Returns the kind of the innermost scope. */
+
+bool
+innermost_scope_is_class_p ()
+{
+ return current_binding_level->parm_flag == 2;
+}
+
static void
declare_namespace_level ()
{
@@ -3380,9 +3388,9 @@ duplicate_decls (newdecl, olddecl)
if (DECL_ANTICIPATED (olddecl))
; /* Do nothing yet. */
else if ((DECL_EXTERN_C_P (newdecl)
- && DECL_EXTERN_C_P (olddecl))
- || compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)),
- TYPE_ARG_TYPES (TREE_TYPE (olddecl))))
+ && DECL_EXTERN_C_P (olddecl))
+ || compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)),
+ TYPE_ARG_TYPES (TREE_TYPE (olddecl))))
{
/* A near match; override the builtin. */
@@ -3409,6 +3417,10 @@ duplicate_decls (newdecl, olddecl)
else if (DECL_ANTICIPATED (olddecl))
TREE_TYPE (olddecl) = TREE_TYPE (newdecl);
+ /* Whether or not the builtin can throw exceptions has no
+ bearing on this declarator. */
+ TREE_NOTHROW (olddecl) = 0;
+
if (DECL_THIS_STATIC (newdecl) && !DECL_THIS_STATIC (olddecl))
{
/* If a builtin function is redeclared as `static', merge
@@ -5398,8 +5410,7 @@ check_goto (decl)
}
/* Define a label, specifying the location in the source file.
- Return the LABEL_DECL node for the label, if the definition is valid.
- Otherwise return 0. */
+ Return the LABEL_DECL node for the label. */
tree
define_label (filename, line, name)
@@ -5426,10 +5437,7 @@ define_label (filename, line, name)
pedwarn ("label named wchar_t");
if (DECL_INITIAL (decl) != NULL_TREE)
- {
- error ("duplicate label `%D'", decl);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
- }
+ error ("duplicate label `%D'", decl);
else
{
/* Mark label as having been defined. */
@@ -5443,9 +5451,10 @@ define_label (filename, line, name)
ent->binding_level = current_binding_level;
}
check_previous_gotos (decl);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
}
+
timevar_pop (TV_NAME_LOOKUP);
+ return decl;
}
struct cp_switch
@@ -7899,15 +7908,18 @@ start_decl_1 (decl)
DECL_INITIAL (decl) = NULL_TREE;
}
-/* Handle initialization of references.
- These three arguments are from `cp_finish_decl', and have the
- same meaning here that they do there.
+/* Handle initialization of references. DECL, TYPE, and INIT have the
+ same meaning as in cp_finish_decl. *CLEANUP must be NULL on entry,
+ but will be set to a new CLEANUP_STMT if a temporary is created
+ that must be destroeyd subsequently.
- Quotes on semantics can be found in ARM 8.4.3. */
+ Returns an initializer expression to use to initialize DECL, or
+ NULL if the initialization can be performed statically.
+ Quotes on semantics can be found in ARM 8.4.3. */
+
static tree
-grok_reference_init (decl, type, init)
- tree decl, type, init;
+grok_reference_init (tree decl, tree type, tree init, tree *cleanup)
{
tree tmp;
@@ -7949,7 +7961,7 @@ grok_reference_init (decl, type, init)
DECL_INITIAL for local references (instead assigning to them
explicitly); we need to allow the temporary to be initialized
first. */
- tmp = initialize_reference (type, init, decl);
+ tmp = initialize_reference (type, init, decl, cleanup);
if (tmp == error_mark_node)
return NULL_TREE;
@@ -8380,13 +8392,14 @@ reshape_init (tree type, tree *initp)
}
/* Verify INIT (the initializer for DECL), and record the
- initialization in DECL_INITIAL, if appropriate.
+ initialization in DECL_INITIAL, if appropriate. CLEANUP is as for
+ grok_reference_init.
If the return value is non-NULL, it is an expression that must be
evaluated dynamically to initialize DECL. */
static tree
-check_initializer (tree decl, tree init, int flags)
+check_initializer (tree decl, tree init, int flags, tree *cleanup)
{
tree type = TREE_TYPE (decl);
@@ -8436,7 +8449,7 @@ check_initializer (tree decl, tree init, int flags)
init = NULL_TREE;
}
else if (!DECL_EXTERNAL (decl) && TREE_CODE (type) == REFERENCE_TYPE)
- init = grok_reference_init (decl, type, init);
+ init = grok_reference_init (decl, type, init, cleanup);
else if (init)
{
if (TREE_CODE (init) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (init))
@@ -8745,8 +8758,9 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
tree asmspec_tree;
int flags;
{
- register tree type;
+ tree type;
tree ttype = NULL_TREE;
+ tree cleanup;
const char *asmspec = NULL;
int was_readonly = 0;
@@ -8757,6 +8771,9 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
return;
}
+ /* Assume no cleanup is required. */
+ cleanup = NULL_TREE;
+
/* If a name was specified, get the string. */
if (global_scope_p (current_binding_level))
asmspec_tree = maybe_apply_renaming_pragma (decl, asmspec_tree);
@@ -8857,7 +8874,7 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
make_decl_rtl (decl, asmspec);
}
else if (TREE_CODE (decl) == RESULT_DECL)
- init = check_initializer (decl, init, flags);
+ init = check_initializer (decl, init, flags, &cleanup);
else if (TREE_CODE (decl) == VAR_DECL)
{
/* Only PODs can have thread-local storage. Other types may require
@@ -8874,7 +8891,7 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
is *not* defined. */
&& (!DECL_EXTERNAL (decl) || init))
{
- init = check_initializer (decl, init, flags);
+ init = check_initializer (decl, init, flags, &cleanup);
/* Thread-local storage cannot be dynamically initialized. */
if (DECL_THREAD_LOCAL (decl) && init)
{
@@ -8993,6 +9010,11 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
}
}
+ /* If a CLEANUP_STMT was created to destroy a temporary bound to a
+ reference, insert it in the statement-tree now. */
+ if (cleanup)
+ add_stmt (cleanup);
+
finish_end:
if (was_readonly)
@@ -12315,7 +12337,10 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
members of other classes. */
/* All method decls are public, so tell grokfndecl to set
TREE_PUBLIC, also. */
- decl = grokfndecl (ctype, type, declarator, declarator,
+ decl = grokfndecl (ctype, type,
+ TREE_CODE (declarator) != TEMPLATE_ID_EXPR
+ ? declarator : dname,
+ declarator,
virtualp, flags, quals, raises,
friendp ? -1 : 0, friendp, 1, 0, funcdef_flag,
template_count, in_namespace);
@@ -14264,7 +14289,7 @@ start_function (declspecs, declarator, attrs, flags)
}
else
{
- decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, NULL);
+ decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, &attrs);
/* If the declarator is not suitable for a function definition,
cause a syntax error. */
if (decl1 == NULL_TREE || TREE_CODE (decl1) != FUNCTION_DECL)
diff --git a/contrib/gcc/cp/decl2.c b/contrib/gcc/cp/decl2.c
index 452f9ad..5561370 100644
--- a/contrib/gcc/cp/decl2.c
+++ b/contrib/gcc/cp/decl2.c
@@ -4137,6 +4137,8 @@ add_function (k, fn)
/* We must find only functions, or exactly one non-function. */
if (!k->functions)
k->functions = fn;
+ else if (fn == k->functions)
+ ;
else if (is_overloaded_fn (k->functions) && is_overloaded_fn (fn))
k->functions = build_overload (fn, k->functions);
else
diff --git a/contrib/gcc/cp/friend.c b/contrib/gcc/cp/friend.c
index 9280a09..0727c39 100644
--- a/contrib/gcc/cp/friend.c
+++ b/contrib/gcc/cp/friend.c
@@ -352,6 +352,8 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
if (is_friend_template)
decl = DECL_TI_TEMPLATE (push_template_decl (decl));
+ else if (DECL_TEMPLATE_INFO (decl))
+ ;
else if (template_class_depth (current_class_type))
decl = push_template_decl_real (decl, /*is_friend=*/1);
diff --git a/contrib/gcc/cp/init.c b/contrib/gcc/cp/init.c
index 83a8753..91ea10c 100644
--- a/contrib/gcc/cp/init.c
+++ b/contrib/gcc/cp/init.c
@@ -2517,6 +2517,10 @@ build_new_1 (exp)
element. */
rval = convert (build_pointer_type (type), rval);
+ /* A new-expression is never an lvalue. */
+ if (real_lvalue_p (rval))
+ rval = build1 (NON_LVALUE_EXPR, TREE_TYPE (rval), rval);
+
return rval;
}
diff --git a/contrib/gcc/cp/pt.c b/contrib/gcc/cp/pt.c
index 62a66d3..64d4428 100644
--- a/contrib/gcc/cp/pt.c
+++ b/contrib/gcc/cp/pt.c
@@ -95,7 +95,7 @@ static void pop_access_scope PARAMS ((tree));
static int resolve_overloaded_unification PARAMS ((tree, tree, tree, tree,
unification_kind_t, int));
static int try_one_overload PARAMS ((tree, tree, tree, tree, tree,
- unification_kind_t, int));
+ unification_kind_t, int, bool));
static int unify PARAMS ((tree, tree, tree, tree, int));
static void add_pending_template PARAMS ((tree));
static void reopen_tinst_level PARAMS ((tree));
@@ -3991,7 +3991,8 @@ lookup_template_function (fns, arglist)
if (fns == error_mark_node || arglist == error_mark_node)
return error_mark_node;
- if (fns == NULL_TREE)
+ if (fns == NULL_TREE
+ || TREE_CODE (fns) == FUNCTION_DECL)
{
error ("non-template used as template");
return error_mark_node;
@@ -8437,9 +8438,15 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict,
{
tree tempargs = copy_node (targs);
int good = 0;
+ bool addr_p;
if (TREE_CODE (arg) == ADDR_EXPR)
- arg = TREE_OPERAND (arg, 0);
+ {
+ arg = TREE_OPERAND (arg, 0);
+ addr_p = true;
+ }
+ else
+ addr_p = false;
if (TREE_CODE (arg) == COMPONENT_REF)
/* Handle `&x' where `x' is some static or non-static member
@@ -8475,10 +8482,8 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict,
if (subargs)
{
elem = tsubst (TREE_TYPE (fn), subargs, tf_none, NULL_TREE);
- if (TREE_CODE (elem) == METHOD_TYPE)
- elem = build_ptrmemfunc_type (build_pointer_type (elem));
- good += try_one_overload (tparms, targs, tempargs, parm, elem,
- strict, sub_strict);
+ good += try_one_overload (tparms, targs, tempargs, parm,
+ elem, strict, sub_strict, addr_p);
}
}
}
@@ -8486,14 +8491,9 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict,
|| TREE_CODE (arg) == FUNCTION_DECL)
{
for (; arg; arg = OVL_NEXT (arg))
- {
- tree type = TREE_TYPE (OVL_CURRENT (arg));
- if (TREE_CODE (type) == METHOD_TYPE)
- type = build_ptrmemfunc_type (build_pointer_type (type));
- good += try_one_overload (tparms, targs, tempargs, parm,
- type,
- strict, sub_strict);
- }
+ good += try_one_overload (tparms, targs, tempargs, parm,
+ TREE_TYPE (OVL_CURRENT (arg)),
+ strict, sub_strict, addr_p);
}
else
abort ();
@@ -8522,14 +8522,20 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict,
/* Subroutine of resolve_overloaded_unification; does deduction for a single
overload. Fills TARGS with any deduced arguments, or error_mark_node if
different overloads deduce different arguments for a given parm.
+ ADDR_P is true if the expression for which deduction is being
+ performed was of the form "& fn" rather than simply "fn".
+
Returns 1 on success. */
static int
-try_one_overload (tparms, orig_targs, targs, parm, arg, strict,
- sub_strict)
- tree tparms, orig_targs, targs, parm, arg;
- unification_kind_t strict;
- int sub_strict;
+try_one_overload (tree tparms,
+ tree orig_targs,
+ tree targs,
+ tree parm,
+ tree arg,
+ unification_kind_t strict,
+ int sub_strict,
+ bool addr_p)
{
int nargs;
tree tempargs;
@@ -8545,6 +8551,11 @@ try_one_overload (tparms, orig_targs, targs, parm, arg, strict,
if (uses_template_parms (arg))
return 1;
+ if (TREE_CODE (arg) == METHOD_TYPE)
+ arg = build_ptrmemfunc_type (build_pointer_type (arg));
+ else if (addr_p)
+ arg = build_pointer_type (arg);
+
sub_strict |= maybe_adjust_types_for_deduction (strict, &parm, &arg);
/* We don't copy orig_targs for this because if we have already deduced
diff --git a/contrib/gcc/cp/search.c b/contrib/gcc/cp/search.c
index 4721a58..c43dd21 100644
--- a/contrib/gcc/cp/search.c
+++ b/contrib/gcc/cp/search.c
@@ -2855,8 +2855,27 @@ add_conversions (binfo, data)
/* Make sure we don't already have this conversion. */
if (! IDENTIFIER_MARKED (name))
{
- *conversions = tree_cons (binfo, tmp, *conversions);
- IDENTIFIER_MARKED (name) = 1;
+ tree t;
+
+ /* Make sure that we do not already have a conversion
+ operator for this type. Merely checking the NAME is not
+ enough because two conversion operators to the same type
+ may not have the same NAME. */
+ for (t = *conversions; t; t = TREE_CHAIN (t))
+ {
+ tree fn;
+ for (fn = TREE_VALUE (t); fn; fn = OVL_NEXT (fn))
+ if (same_type_p (TREE_TYPE (name),
+ DECL_CONV_FN_TYPE (OVL_CURRENT (fn))))
+ break;
+ if (fn)
+ break;
+ }
+ if (!t)
+ {
+ *conversions = tree_cons (binfo, tmp, *conversions);
+ IDENTIFIER_MARKED (name) = 1;
+ }
}
}
return NULL_TREE;
diff --git a/contrib/gcc/cp/tree.c b/contrib/gcc/cp/tree.c
index ce6137e..1551df0 100644
--- a/contrib/gcc/cp/tree.c
+++ b/contrib/gcc/cp/tree.c
@@ -357,6 +357,14 @@ build_target_expr_with_type (init, type)
if (TREE_CODE (init) == TARGET_EXPR)
return init;
+ else if (CLASS_TYPE_P (type) && !TYPE_HAS_TRIVIAL_INIT_REF (type)
+ && TREE_CODE (init) != COND_EXPR
+ && TREE_CODE (init) != CONSTRUCTOR)
+ /* We need to build up a copy constructor call. COND_EXPR is a special
+ case because we already have copies on the arms and we don't want
+ another one here. A CONSTRUCTOR is aggregate initialization, which
+ is handled separately. */
+ return force_rvalue (init);
slot = build (VAR_DECL, type);
DECL_ARTIFICIAL (slot) = 1;
@@ -375,97 +383,6 @@ get_target_expr (init)
{
return build_target_expr_with_type (init, TREE_TYPE (init));
}
-
-/* Recursively perform a preorder search EXP for CALL_EXPRs, making
- copies where they are found. Returns a deep copy all nodes transitively
- containing CALL_EXPRs. */
-
-tree
-break_out_calls (exp)
- tree exp;
-{
- register tree t1, t2 = NULL_TREE;
- register enum tree_code code;
- register int changed = 0;
- register int i;
-
- if (exp == NULL_TREE)
- return exp;
-
- code = TREE_CODE (exp);
-
- if (code == CALL_EXPR)
- return copy_node (exp);
-
- /* Don't try and defeat a save_expr, as it should only be done once. */
- if (code == SAVE_EXPR)
- return exp;
-
- switch (TREE_CODE_CLASS (code))
- {
- default:
- abort ();
-
- case 'c': /* a constant */
- case 't': /* a type node */
- case 'x': /* something random, like an identifier or an ERROR_MARK. */
- return exp;
-
- case 'd': /* A decl node */
-#if 0 /* This is bogus. jason 9/21/94 */
-
- t1 = break_out_calls (DECL_INITIAL (exp));
- if (t1 != DECL_INITIAL (exp))
- {
- exp = copy_node (exp);
- DECL_INITIAL (exp) = t1;
- }
-#endif
- return exp;
-
- case 'b': /* A block node */
- {
- /* Don't know how to handle these correctly yet. Must do a
- break_out_calls on all DECL_INITIAL values for local variables,
- and also break_out_calls on all sub-blocks and sub-statements. */
- abort ();
- }
- return exp;
-
- case 'e': /* an expression */
- case 'r': /* a reference */
- case 's': /* an expression with side effects */
- for (i = TREE_CODE_LENGTH (code) - 1; i >= 0; i--)
- {
- t1 = break_out_calls (TREE_OPERAND (exp, i));
- if (t1 != TREE_OPERAND (exp, i))
- {
- exp = copy_node (exp);
- TREE_OPERAND (exp, i) = t1;
- }
- }
- return exp;
-
- case '<': /* a comparison expression */
- case '2': /* a binary arithmetic expression */
- t2 = break_out_calls (TREE_OPERAND (exp, 1));
- if (t2 != TREE_OPERAND (exp, 1))
- changed = 1;
- case '1': /* a unary arithmetic expression */
- t1 = break_out_calls (TREE_OPERAND (exp, 0));
- if (t1 != TREE_OPERAND (exp, 0))
- changed = 1;
- if (changed)
- {
- if (TREE_CODE_LENGTH (code) == 1)
- return build1 (code, TREE_TYPE (exp), t1);
- else
- return build (code, TREE_TYPE (exp), t1, t2);
- }
- return exp;
- }
-
-}
/* Construct, lay out and return the type of methods belonging to class
BASETYPE and whose arguments are described by ARGTYPES and whose values
diff --git a/contrib/gcc/cp/typeck.c b/contrib/gcc/cp/typeck.c
index c161e11..4b36cc2 100644
--- a/contrib/gcc/cp/typeck.c
+++ b/contrib/gcc/cp/typeck.c
@@ -909,10 +909,8 @@ comptypes (t1, t2, strict)
if (t1 == t2)
return 1;
- /* This should never happen. */
- my_friendly_assert (t1 != error_mark_node, 307);
-
- if (t2 == error_mark_node)
+ /* Suppress errors caused by previously reported errors */
+ if (t1 == error_mark_node || t2 == error_mark_node)
return 0;
/* If either type is the internal version of sizetype, return the
@@ -1405,7 +1403,7 @@ compparms (parms1, parms2)
they fail to match. */
if (t1 == 0 || t2 == 0)
return 0;
- if (!same_type_p (TREE_VALUE (t2), TREE_VALUE (t1)))
+ if (!same_type_p (TREE_VALUE (t1), TREE_VALUE (t2)))
return 0;
t1 = TREE_CHAIN (t1);
@@ -2174,8 +2172,13 @@ finish_class_member_access_expr (tree object, tree name)
/* Find the base of OBJECT_TYPE corresponding to SCOPE. */
access_path = lookup_base (object_type, scope, ba_check, NULL);
- if (!access_path || access_path == error_mark_node)
+ if (access_path == error_mark_node)
return error_mark_node;
+ if (!access_path)
+ {
+ error ("`%T' is not a base of `%T'", scope, object_type);
+ return error_mark_node;
+ }
/* Look up the member. */
member = lookup_member (access_path, name, /*protect=*/1,
@@ -2641,9 +2644,9 @@ get_member_function_from_ptrfunc (instance_ptrptr, function)
}
tree
-build_function_call_real (function, params, require_complete, flags)
+build_function_call_real (function, params, flags)
tree function, params;
- int require_complete, flags;
+ int flags;
{
register tree fntype, fndecl;
register tree coerced_params;
@@ -2757,7 +2760,7 @@ tree
build_function_call (function, params)
tree function, params;
{
- return build_function_call_real (function, params, 1, LOOKUP_NORMAL);
+ return build_function_call_real (function, params, LOOKUP_NORMAL);
}
/* Convert the actual parameter expressions in the list VALUES
@@ -4739,12 +4742,13 @@ build_static_cast (type, expr)
(TREE_TYPE (type))))
&& at_least_as_qualified_p (TREE_TYPE (type), intype))
{
- /* At this point we have checked all of the conditions except
- that B is not a virtual base class of D. That will be
- checked by build_base_path. */
- tree base = lookup_base (TREE_TYPE (type), intype, ba_any, NULL);
+ /* There is a standard conversion from "D*" to "B*" even if "B"
+ is ambiguous or inaccessible. Therefore, we ask lookup_base
+ to check these conditions. */
+ tree base = lookup_base (TREE_TYPE (type), intype, ba_check, NULL);
- /* Convert from B* to D*. */
+ /* Convert from "B*" to "D*". This function will check that "B"
+ is not a virtual base of "D". */
expr = build_base_path (MINUS_EXPR, build_address (expr),
base, /*nonnull=*/false);
/* Convert the pointer to a reference -- but then remember that
@@ -4803,7 +4807,7 @@ build_static_cast (type, expr)
check_for_casting_away_constness (intype, type);
base = lookup_base (TREE_TYPE (type), TREE_TYPE (intype),
- ba_check | ba_quiet, NULL);
+ ba_check, NULL);
return build_base_path (MINUS_EXPR, expr, base, /*nonnull=*/false);
}
if ((TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
@@ -5237,6 +5241,10 @@ build_modify_expr (lhs, modifycode, rhs)
TREE_OPERAND (lhs, 0), newrhs);
case MODIFY_EXPR:
+ if (TREE_SIDE_EFFECTS (TREE_OPERAND (lhs, 0)))
+ lhs = build (TREE_CODE (lhs), TREE_TYPE (lhs),
+ stabilize_reference (TREE_OPERAND (lhs, 0)),
+ TREE_OPERAND (lhs, 1));
newrhs = build_modify_expr (TREE_OPERAND (lhs, 0), modifycode, rhs);
if (newrhs == error_mark_node)
return error_mark_node;
@@ -5288,8 +5296,9 @@ build_modify_expr (lhs, modifycode, rhs)
{
if (TREE_CODE (rhs) == CONSTRUCTOR)
{
- my_friendly_assert (same_type_p (TREE_TYPE (rhs), lhstype),
- 20011220);
+ if (! same_type_p (TREE_TYPE (rhs), lhstype))
+ /* Call convert to generate an error; see PR 11063. */
+ rhs = convert (lhstype, rhs);
result = build (INIT_EXPR, lhstype, lhs, rhs);
TREE_SIDE_EFFECTS (result) = 1;
return result;
@@ -5442,14 +5451,6 @@ build_modify_expr (lhs, modifycode, rhs)
}
}
- if (TREE_CODE (lhstype) != REFERENCE_TYPE)
- {
- if (TREE_SIDE_EFFECTS (lhs))
- lhs = stabilize_reference (lhs);
- if (TREE_SIDE_EFFECTS (newrhs))
- newrhs = stabilize_reference (newrhs);
- }
-
/* Convert new value to destination type. */
if (TREE_CODE (lhstype) == ARRAY_TYPE)
@@ -5505,44 +5506,8 @@ build_modify_expr (lhs, modifycode, rhs)
if (newrhs == error_mark_node)
return error_mark_node;
- if (TREE_CODE (newrhs) == COND_EXPR)
- {
- tree lhs1;
- tree cond = TREE_OPERAND (newrhs, 0);
-
- if (TREE_SIDE_EFFECTS (lhs))
- cond = build_compound_expr (tree_cons
- (NULL_TREE, lhs,
- build_tree_list (NULL_TREE, cond)));
-
- /* Cannot have two identical lhs on this one tree (result) as preexpand
- calls will rip them out and fill in RTL for them, but when the
- rtl is generated, the calls will only be in the first side of the
- condition, not on both, or before the conditional jump! (mrs) */
- lhs1 = break_out_calls (lhs);
-
- if (lhs == lhs1)
- /* If there's no change, the COND_EXPR behaves like any other rhs. */
- result = build (modifycode == NOP_EXPR ? MODIFY_EXPR : INIT_EXPR,
- lhstype, lhs, newrhs);
- else
- {
- tree result_type = TREE_TYPE (newrhs);
- /* We have to convert each arm to the proper type because the
- types may have been munged by constant folding. */
- result
- = build (COND_EXPR, result_type, cond,
- build_modify_expr (lhs, modifycode,
- cp_convert (result_type,
- TREE_OPERAND (newrhs, 1))),
- build_modify_expr (lhs1, modifycode,
- cp_convert (result_type,
- TREE_OPERAND (newrhs, 2))));
- }
- }
- else
- result = build (modifycode == NOP_EXPR ? MODIFY_EXPR : INIT_EXPR,
- lhstype, lhs, newrhs);
+ result = build (modifycode == NOP_EXPR ? MODIFY_EXPR : INIT_EXPR,
+ lhstype, lhs, newrhs);
TREE_SIDE_EFFECTS (result) = 1;
@@ -6100,7 +6065,8 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
if (fndecl)
savew = warningcount, savee = errorcount;
- rhs = initialize_reference (type, rhs, /*decl=*/NULL_TREE);
+ rhs = initialize_reference (type, rhs, /*decl=*/NULL_TREE,
+ /*cleanup=*/NULL);
if (fndecl)
{
if (warningcount > savew)
diff --git a/contrib/gcc/cp/typeck2.c b/contrib/gcc/cp/typeck2.c
index 0e70e2b..b063f42 100644
--- a/contrib/gcc/cp/typeck2.c
+++ b/contrib/gcc/cp/typeck2.c
@@ -279,7 +279,8 @@ retry:
break;
default:
- abort ();
+ (*p_msg) ("invalid use of incomplete type");
+ break;
}
}
OpenPOWER on IntegriCloud