Commit 655dc6ee by Jason Merrill Committed by Jason Merrill

pt.c (tsubst_decl, [...]): Clear DECL_SAVED_TREE.

        * pt.c (tsubst_decl, case FUNCTION_DECL): Clear DECL_SAVED_TREE.
        (tsubst_friend_function): Copy it here.

        * decl.c (grok_op_properties): Fix typo.

        * decl2.c (delete_sanity): Clarify warning, avoid failure on
        deleting void*.

        * pt.c (check_explicit_specialization): Clarify error.

        * decl.c (pushdecl): Also pull out one of the FUNCTION_DECLs from
        an old OVERLOAD when we're declaring a non-function.
        (pushdecl, destroy_local_var): Check for error_mark_node.
        (warn_extern_redeclared_static): Also bail early if
        we're a CONST_DECL.
        (push_overloaded_decl): Ignore an old error_mark_node.

From-SVN: r34652
parent be05b708
2000-06-22 Jason Merrill <jason@redhat.com>
* pt.c (tsubst_decl, case FUNCTION_DECL): Clear DECL_SAVED_TREE.
(tsubst_friend_function): Copy it here.
* decl.c (grok_op_properties): Fix typo.
* decl2.c (delete_sanity): Clarify warning, avoid failure on
deleting void*.
* pt.c (check_explicit_specialization): Clarify error.
* decl.c (pushdecl): Also pull out one of the FUNCTION_DECLs from
an old OVERLOAD when we're declaring a non-function.
(pushdecl, destroy_local_var): Check for error_mark_node.
(warn_extern_redeclared_static): Also bail early if
we're a CONST_DECL.
(push_overloaded_decl): Ignore an old error_mark_node.
2000-06-22 Nathan Sidwell <nathan@codesourcery.com> 2000-06-22 Nathan Sidwell <nathan@codesourcery.com>
* call.c (build_x_va_arg): Check if in a template decl. * call.c (build_x_va_arg): Check if in a template decl.
......
...@@ -3092,7 +3092,8 @@ warn_extern_redeclared_static (newdecl, olddecl) ...@@ -3092,7 +3092,8 @@ warn_extern_redeclared_static (newdecl, olddecl)
tree name; tree name;
if (TREE_CODE (newdecl) == TYPE_DECL if (TREE_CODE (newdecl) == TYPE_DECL
|| TREE_CODE (newdecl) == TEMPLATE_DECL) || TREE_CODE (newdecl) == TEMPLATE_DECL
|| TREE_CODE (newdecl) == CONST_DECL)
return; return;
/* Don't get confused by static member functions; that's a different /* Don't get confused by static member functions; that's a different
...@@ -3863,14 +3864,20 @@ pushdecl (x) ...@@ -3863,14 +3864,20 @@ pushdecl (x)
actually the same as the function we are declaring. (If actually the same as the function we are declaring. (If
there is one, we have to merge our declaration with the there is one, we have to merge our declaration with the
previous declaration.) */ previous declaration.) */
if (t && TREE_CODE (t) == OVERLOAD && TREE_CODE (x) == FUNCTION_DECL) if (t && TREE_CODE (t) == OVERLOAD)
{ {
tree match; tree match;
for (match = t; match; match = OVL_NEXT (match)) if (TREE_CODE (x) == FUNCTION_DECL)
if (DECL_ASSEMBLER_NAME (OVL_CURRENT (t)) for (match = t; match; match = OVL_NEXT (match))
== DECL_ASSEMBLER_NAME (x)) {
break; if (DECL_ASSEMBLER_NAME (OVL_CURRENT (t))
== DECL_ASSEMBLER_NAME (x))
break;
}
else
/* Just choose one. */
match = t;
if (match) if (match)
t = OVL_CURRENT (match); t = OVL_CURRENT (match);
...@@ -3972,7 +3979,7 @@ pushdecl (x) ...@@ -3972,7 +3979,7 @@ pushdecl (x)
if (TREE_CODE (x) == TYPE_DECL) if (TREE_CODE (x) == TYPE_DECL)
{ {
tree type = TREE_TYPE (x); tree type = TREE_TYPE (x);
if (DECL_SOURCE_LINE (x) == 0) if (DECL_SOURCE_LINE (x) == 0)
{ {
if (TYPE_NAME (type) == 0) if (TYPE_NAME (type) == 0)
TYPE_NAME (type) = x; TYPE_NAME (type) = x;
...@@ -4010,6 +4017,7 @@ pushdecl (x) ...@@ -4010,6 +4017,7 @@ pushdecl (x)
tree decl; tree decl;
if (IDENTIFIER_NAMESPACE_VALUE (name) != NULL_TREE if (IDENTIFIER_NAMESPACE_VALUE (name) != NULL_TREE
&& IDENTIFIER_NAMESPACE_VALUE (name) != error_mark_node
&& (DECL_EXTERNAL (IDENTIFIER_NAMESPACE_VALUE (name)) && (DECL_EXTERNAL (IDENTIFIER_NAMESPACE_VALUE (name))
|| TREE_PUBLIC (IDENTIFIER_NAMESPACE_VALUE (name)))) || TREE_PUBLIC (IDENTIFIER_NAMESPACE_VALUE (name))))
decl = IDENTIFIER_NAMESPACE_VALUE (name); decl = IDENTIFIER_NAMESPACE_VALUE (name);
...@@ -4577,6 +4585,9 @@ push_overloaded_decl (decl, flags) ...@@ -4577,6 +4585,9 @@ push_overloaded_decl (decl, flags)
return fn; return fn;
} }
} }
else if (old == error_mark_node)
/* Ignore the undefined symbol marker. */
old = NULL_TREE;
else else
{ {
cp_error_at ("previous non-function declaration `%#D'", old); cp_error_at ("previous non-function declaration `%#D'", old);
...@@ -8022,7 +8033,8 @@ destroy_local_var (decl) ...@@ -8022,7 +8033,8 @@ destroy_local_var (decl)
return; return;
/* And only things with destructors need cleaning up. */ /* And only things with destructors need cleaning up. */
if (TYPE_HAS_TRIVIAL_DESTRUCTOR (type)) if (type == error_mark_node
|| TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
return; return;
if (TREE_CODE (decl) == VAR_DECL && if (TREE_CODE (decl) == VAR_DECL &&
...@@ -12583,7 +12595,7 @@ grok_op_properties (decl, virtualp, friendp) ...@@ -12583,7 +12595,7 @@ grok_op_properties (decl, virtualp, friendp)
break; break;
case PREDECREMENT_EXPR: case PREDECREMENT_EXPR:
operator_code = PREDECREMENT_EXPR; operator_code = POSTDECREMENT_EXPR;
break; break;
default: default:
......
...@@ -1283,8 +1283,11 @@ delete_sanity (exp, size, doing_vec, use_global_delete) ...@@ -1283,8 +1283,11 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
/* Deleting ptr to void is undefined behaviour [expr.delete/3]. */ /* Deleting ptr to void is undefined behaviour [expr.delete/3]. */
if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE) if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE)
cp_warning ("`%T' is not a pointer-to-object type", type); {
cp_warning ("deleting `%T' is undefined", type);
doing_vec = 0;
}
/* An array can't have been allocated by new, so complain. */ /* An array can't have been allocated by new, so complain. */
if (TREE_CODE (t) == ADDR_EXPR if (TREE_CODE (t) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (t, 0)) == VAR_DECL && TREE_CODE (TREE_OPERAND (t, 0)) == VAR_DECL
......
...@@ -1300,8 +1300,12 @@ check_explicit_specialization (declarator, decl, template_count, flags) ...@@ -1300,8 +1300,12 @@ check_explicit_specialization (declarator, decl, template_count, flags)
/* This case handles bogus declarations like template <> /* This case handles bogus declarations like template <>
template <class T> void f<int>(); */ template <class T> void f<int>(); */
cp_error ("template-id `%D' in declaration of primary template", if (uses_template_parms (declarator))
declarator); cp_error ("partial specialization `%D' of function template",
declarator);
else
cp_error ("template-id `%D' in declaration of primary template",
declarator);
return decl; return decl;
} }
...@@ -4507,7 +4511,11 @@ tsubst_friend_function (decl, args) ...@@ -4507,7 +4511,11 @@ tsubst_friend_function (decl, args)
instantiation of anything. */ instantiation of anything. */
DECL_USE_TEMPLATE (new_friend) = 0; DECL_USE_TEMPLATE (new_friend) = 0;
if (TREE_CODE (decl) == TEMPLATE_DECL) if (TREE_CODE (decl) == TEMPLATE_DECL)
DECL_USE_TEMPLATE (DECL_TEMPLATE_RESULT (new_friend)) = 0; {
DECL_USE_TEMPLATE (DECL_TEMPLATE_RESULT (new_friend)) = 0;
DECL_SAVED_TREE (DECL_TEMPLATE_RESULT (new_friend))
= DECL_SAVED_TREE (DECL_TEMPLATE_RESULT (decl));
}
/* The mangled name for the NEW_FRIEND is incorrect. The call to /* The mangled name for the NEW_FRIEND is incorrect. The call to
tsubst will have resulted in a call to tsubst will have resulted in a call to
...@@ -5727,6 +5735,7 @@ tsubst_decl (t, args, type, in_decl) ...@@ -5727,6 +5735,7 @@ tsubst_decl (t, args, type, in_decl)
TREE_CHAIN (r) = NULL_TREE; TREE_CHAIN (r) = NULL_TREE;
DECL_PENDING_INLINE_INFO (r) = 0; DECL_PENDING_INLINE_INFO (r) = 0;
DECL_PENDING_INLINE_P (r) = 0; DECL_PENDING_INLINE_P (r) = 0;
DECL_SAVED_TREE (r) = NULL_TREE;
TREE_USED (r) = 0; TREE_USED (r) = 0;
if (DECL_CLONED_FUNCTION (r)) if (DECL_CLONED_FUNCTION (r))
{ {
......
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