aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-10-01 10:37:08 -0400
committerJason Merrill <jason@gcc.gnu.org>2009-10-01 10:37:08 -0400
commit2968d410491161912b56a2ec7f7528d06d5ba19d (patch)
tree231dd165dc3382239b05438e1931cab7f322e2ee /gcc/cp/decl.c
parent3a303360aaa25cc639216d82b3c33b317937cb9d (diff)
downloadgcc-2968d410491161912b56a2ec7f7528d06d5ba19d.zip
gcc-2968d410491161912b56a2ec7f7528d06d5ba19d.tar.gz
gcc-2968d410491161912b56a2ec7f7528d06d5ba19d.tar.bz2
pt.c (register_specialization): Push DECL_SOURCE_LOCATION to the clones.
* pt.c (register_specialization): Push DECL_SOURCE_LOCATION to the clones. * decl.c (grok_special_member_properties): Only adjust TYPE_HAS_COMPLEX_* if the function is defaulted in the class body. (cp_finish_decl): Push DECL_DELETED_FN/DECL_DEFAULTED_FN to the clones. From-SVN: r152373
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index cb2827d..9f5ca30 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5586,12 +5586,19 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
if (init && TREE_CODE (decl) == FUNCTION_DECL)
{
+ tree clone;
if (init == ridpointers[(int)RID_DELETE])
{
/* FIXME check this is 1st decl. */
DECL_DELETED_FN (decl) = 1;
DECL_DECLARED_INLINE_P (decl) = 1;
DECL_INITIAL (decl) = error_mark_node;
+ FOR_EACH_CLONE (clone, decl)
+ {
+ DECL_DELETED_FN (clone) = 1;
+ DECL_DECLARED_INLINE_P (clone) = 1;
+ DECL_INITIAL (clone) = error_mark_node;
+ }
init = NULL_TREE;
}
else if (init == ridpointers[(int)RID_DEFAULT])
@@ -5602,7 +5609,11 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
DECL_INITIAL (decl) = NULL_TREE;
}
else
- DECL_DEFAULTED_FN (decl) = 1;
+ {
+ DECL_DEFAULTED_FN (decl) = 1;
+ FOR_EACH_CLONE (clone, decl)
+ DECL_DEFAULTED_FN (clone) = 1;
+ }
}
}
@@ -9966,6 +9977,10 @@ move_fn_p (const_tree d)
/* Remember any special properties of member function DECL. */
+#define DECL_DEFAULTED_IN_CLASS_P(DECL) \
+ (DECL_DEFAULTED_FN (DECL) \
+ && (DECL_ARTIFICIAL (DECL) || DECL_INITIALIZED_IN_CLASS_P (DECL)))
+
void
grok_special_member_properties (tree decl)
{
@@ -9992,7 +10007,7 @@ grok_special_member_properties (tree decl)
are no other parameters or else all other parameters have
default arguments. */
TYPE_HAS_INIT_REF (class_type) = 1;
- if (!DECL_DEFAULTED_FN (decl))
+ if (!DECL_DEFAULTED_IN_CLASS_P (decl))
TYPE_HAS_COMPLEX_INIT_REF (class_type) = 1;
if (ctor > 1)
TYPE_HAS_CONST_INIT_REF (class_type) = 1;
@@ -10000,7 +10015,8 @@ grok_special_member_properties (tree decl)
else if (sufficient_parms_p (FUNCTION_FIRST_USER_PARMTYPE (decl)))
{
TYPE_HAS_DEFAULT_CONSTRUCTOR (class_type) = 1;
- if (TREE_CODE (decl) == TEMPLATE_DECL || !DECL_DEFAULTED_FN (decl))
+ if (TREE_CODE (decl) == TEMPLATE_DECL
+ || !DECL_DEFAULTED_IN_CLASS_P (decl))
TYPE_HAS_COMPLEX_DFLT (class_type) = 1;
}
else if (is_list_ctor (decl))
@@ -10019,7 +10035,7 @@ grok_special_member_properties (tree decl)
if (assop)
{
TYPE_HAS_ASSIGN_REF (class_type) = 1;
- if (!DECL_DEFAULTED_FN (decl))
+ if (!DECL_DEFAULTED_IN_CLASS_P (decl))
TYPE_HAS_COMPLEX_ASSIGN_REF (class_type) = 1;
if (assop != 1)
TYPE_HAS_CONST_ASSIGN_REF (class_type) = 1;