re PR c++/50500 ([C++0x] [DR 1082] move constructor should cause copy constructor to be deleted, but still declared)
PR c++/50500 DR 1082 * search.c (lookup_fnfields_idx_nolazy): Split out from... (lookup_fnfields_1): ...here. (lookup_fnfields_slot_nolazy): Use it. * cp-tree.h: Declare it. * class.c (type_has_move_assign): Use it. (type_has_user_declared_move_assign): Likewise. From-SVN: r180738
This commit is contained in:
parent
a31895d78b
commit
fa4ba4affe
|
@ -1,3 +1,14 @@
|
|||
2011-11-01 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/50500
|
||||
DR 1082
|
||||
* search.c (lookup_fnfields_idx_nolazy): Split out from...
|
||||
(lookup_fnfields_1): ...here.
|
||||
(lookup_fnfields_slot_nolazy): Use it.
|
||||
* cp-tree.h: Declare it.
|
||||
* class.c (type_has_move_assign): Use it.
|
||||
(type_has_user_declared_move_assign): Likewise.
|
||||
|
||||
2011-10-31 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/50920
|
||||
|
|
|
@ -4485,7 +4485,7 @@ type_has_move_assign (tree t)
|
|||
lazily_declare_fn (sfk_move_assignment, t);
|
||||
}
|
||||
|
||||
for (fns = lookup_fnfields_slot (t, ansi_assopname (NOP_EXPR));
|
||||
for (fns = lookup_fnfields_slot_nolazy (t, ansi_assopname (NOP_EXPR));
|
||||
fns; fns = OVL_NEXT (fns))
|
||||
if (move_fn_p (OVL_CURRENT (fns)))
|
||||
return true;
|
||||
|
@ -4530,7 +4530,7 @@ type_has_user_declared_move_assign (tree t)
|
|||
if (CLASSTYPE_LAZY_MOVE_ASSIGN (t))
|
||||
return false;
|
||||
|
||||
for (fns = lookup_fnfields_slot (t, ansi_assopname (NOP_EXPR));
|
||||
for (fns = lookup_fnfields_slot_nolazy (t, ansi_assopname (NOP_EXPR));
|
||||
fns; fns = OVL_NEXT (fns))
|
||||
{
|
||||
tree fn = OVL_CURRENT (fns);
|
||||
|
|
|
@ -5328,6 +5328,7 @@ extern tree lookup_field_1 (tree, tree, bool);
|
|||
extern tree lookup_field (tree, tree, int, bool);
|
||||
extern int lookup_fnfields_1 (tree, tree);
|
||||
extern tree lookup_fnfields_slot (tree, tree);
|
||||
extern tree lookup_fnfields_slot_nolazy (tree, tree);
|
||||
extern int class_method_index_for_fn (tree, tree);
|
||||
extern tree lookup_fnfields (tree, tree, int);
|
||||
extern tree lookup_member (tree, tree, int, bool);
|
||||
|
|
|
@ -1335,10 +1335,11 @@ lookup_conversion_operator (tree class_type, tree type)
|
|||
}
|
||||
|
||||
/* TYPE is a class type. Return the index of the fields within
|
||||
the method vector with name NAME, or -1 if no such field exists. */
|
||||
the method vector with name NAME, or -1 if no such field exists.
|
||||
Does not lazily declare implicitly-declared member functions. */
|
||||
|
||||
int
|
||||
lookup_fnfields_1 (tree type, tree name)
|
||||
static int
|
||||
lookup_fnfields_idx_nolazy (tree type, tree name)
|
||||
{
|
||||
VEC(tree,gc) *method_vec;
|
||||
tree fn;
|
||||
|
@ -1348,34 +1349,6 @@ lookup_fnfields_1 (tree type, tree name)
|
|||
if (!CLASS_TYPE_P (type))
|
||||
return -1;
|
||||
|
||||
if (COMPLETE_TYPE_P (type))
|
||||
{
|
||||
if ((name == ctor_identifier
|
||||
|| name == base_ctor_identifier
|
||||
|| name == complete_ctor_identifier))
|
||||
{
|
||||
if (CLASSTYPE_LAZY_DEFAULT_CTOR (type))
|
||||
lazily_declare_fn (sfk_constructor, type);
|
||||
if (CLASSTYPE_LAZY_COPY_CTOR (type))
|
||||
lazily_declare_fn (sfk_copy_constructor, type);
|
||||
if (CLASSTYPE_LAZY_MOVE_CTOR (type))
|
||||
lazily_declare_fn (sfk_move_constructor, type);
|
||||
}
|
||||
else if (name == ansi_assopname (NOP_EXPR))
|
||||
{
|
||||
if (CLASSTYPE_LAZY_COPY_ASSIGN (type))
|
||||
lazily_declare_fn (sfk_copy_assignment, type);
|
||||
if (CLASSTYPE_LAZY_MOVE_ASSIGN (type))
|
||||
lazily_declare_fn (sfk_move_assignment, type);
|
||||
}
|
||||
else if ((name == dtor_identifier
|
||||
|| name == base_dtor_identifier
|
||||
|| name == complete_dtor_identifier
|
||||
|| name == deleting_dtor_identifier)
|
||||
&& CLASSTYPE_LAZY_DESTRUCTOR (type))
|
||||
lazily_declare_fn (sfk_destructor, type);
|
||||
}
|
||||
|
||||
method_vec = CLASSTYPE_METHOD_VEC (type);
|
||||
if (!method_vec)
|
||||
return -1;
|
||||
|
@ -1445,6 +1418,46 @@ lookup_fnfields_1 (tree type, tree name)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* TYPE is a class type. Return the index of the fields within
|
||||
the method vector with name NAME, or -1 if no such field exists. */
|
||||
|
||||
int
|
||||
lookup_fnfields_1 (tree type, tree name)
|
||||
{
|
||||
if (!CLASS_TYPE_P (type))
|
||||
return -1;
|
||||
|
||||
if (COMPLETE_TYPE_P (type))
|
||||
{
|
||||
if ((name == ctor_identifier
|
||||
|| name == base_ctor_identifier
|
||||
|| name == complete_ctor_identifier))
|
||||
{
|
||||
if (CLASSTYPE_LAZY_DEFAULT_CTOR (type))
|
||||
lazily_declare_fn (sfk_constructor, type);
|
||||
if (CLASSTYPE_LAZY_COPY_CTOR (type))
|
||||
lazily_declare_fn (sfk_copy_constructor, type);
|
||||
if (CLASSTYPE_LAZY_MOVE_CTOR (type))
|
||||
lazily_declare_fn (sfk_move_constructor, type);
|
||||
}
|
||||
else if (name == ansi_assopname (NOP_EXPR))
|
||||
{
|
||||
if (CLASSTYPE_LAZY_COPY_ASSIGN (type))
|
||||
lazily_declare_fn (sfk_copy_assignment, type);
|
||||
if (CLASSTYPE_LAZY_MOVE_ASSIGN (type))
|
||||
lazily_declare_fn (sfk_move_assignment, type);
|
||||
}
|
||||
else if ((name == dtor_identifier
|
||||
|| name == base_dtor_identifier
|
||||
|| name == complete_dtor_identifier
|
||||
|| name == deleting_dtor_identifier)
|
||||
&& CLASSTYPE_LAZY_DESTRUCTOR (type))
|
||||
lazily_declare_fn (sfk_destructor, type);
|
||||
}
|
||||
|
||||
return lookup_fnfields_idx_nolazy (type, name);
|
||||
}
|
||||
|
||||
/* TYPE is a class type. Return the field within the method vector with
|
||||
name NAME, or NULL_TREE if no such field exists. */
|
||||
|
||||
|
@ -1457,6 +1470,17 @@ lookup_fnfields_slot (tree type, tree name)
|
|||
return VEC_index (tree, CLASSTYPE_METHOD_VEC (type), ix);
|
||||
}
|
||||
|
||||
/* As above, but avoid lazily declaring functions. */
|
||||
|
||||
tree
|
||||
lookup_fnfields_slot_nolazy (tree type, tree name)
|
||||
{
|
||||
int ix = lookup_fnfields_idx_nolazy (complete_type (type), name);
|
||||
if (ix < 0)
|
||||
return NULL_TREE;
|
||||
return VEC_index (tree, CLASSTYPE_METHOD_VEC (type), ix);
|
||||
}
|
||||
|
||||
/* Like lookup_fnfields_1, except that the name is extracted from
|
||||
FUNCTION, which is a FUNCTION_DECL or a TEMPLATE_DECL. */
|
||||
|
||||
|
|
Loading…
Reference in New Issue