re PR c++/17585 (usage of unqualified name of static member from within class not allowed)
PR c++/17585 * cp-tree.h (shared_member_p): Declare. * search.c (shared_member_p): Give it external linkage. * semantics.c (finish_qualified_id_expr): Use it. (finish_id_expression): Likewise. From-SVN: r88188
This commit is contained in:
parent
7e200b5010
commit
821eaf2a80
@ -1,5 +1,11 @@
|
||||
2004-09-27 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/17585
|
||||
* cp-tree.h (shared_member_p): Declare.
|
||||
* search.c (shared_member_p): Give it external linkage.
|
||||
* semantics.c (finish_qualified_id_expr): Use it.
|
||||
(finish_id_expression): Likewise.
|
||||
|
||||
PR c++/17585
|
||||
* semantics.c (finish_id_expression): Do not add "this->" to
|
||||
static member functions.
|
||||
|
@ -4023,6 +4023,7 @@ extern tree adjust_result_of_qualified_name_lookup
|
||||
(tree, tree, tree);
|
||||
extern tree copied_binfo (tree, tree);
|
||||
extern tree original_binfo (tree, tree);
|
||||
extern int shared_member_p (tree);
|
||||
|
||||
/* in semantics.c */
|
||||
extern void push_deferring_access_checks (deferring_kind);
|
||||
|
@ -56,7 +56,6 @@ static int lookup_conversions_r (tree, int, int,
|
||||
tree, tree, tree, tree, tree *, tree *);
|
||||
static int look_for_overrides_r (tree, tree);
|
||||
static tree lookup_field_queue_p (tree, int, void *);
|
||||
static int shared_member_p (tree);
|
||||
static tree lookup_field_r (tree, void *);
|
||||
static tree dfs_accessible_queue_p (tree, int, void *);
|
||||
static tree dfs_accessible_p (tree, void *);
|
||||
@ -1025,7 +1024,7 @@ template_self_reference_p (tree type, tree decl)
|
||||
|
||||
This function checks that T contains no nonstatic members. */
|
||||
|
||||
static int
|
||||
int
|
||||
shared_member_p (tree t)
|
||||
{
|
||||
if (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == TYPE_DECL \
|
||||
|
@ -1426,19 +1426,16 @@ finish_qualified_id_expr (tree qualifying_class, tree expr, bool done,
|
||||
qualifying_class);
|
||||
else if (BASELINK_P (expr) && !processing_template_decl)
|
||||
{
|
||||
tree fn;
|
||||
tree fns;
|
||||
|
||||
/* See if any of the functions are non-static members. */
|
||||
fns = BASELINK_FUNCTIONS (expr);
|
||||
if (TREE_CODE (fns) == TEMPLATE_ID_EXPR)
|
||||
fns = TREE_OPERAND (fns, 0);
|
||||
for (fn = fns; fn; fn = OVL_NEXT (fn))
|
||||
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
|
||||
break;
|
||||
/* If so, the expression may be relative to the current
|
||||
class. */
|
||||
if (fn && current_class_type
|
||||
if (!shared_member_p (fns)
|
||||
&& current_class_type
|
||||
&& DERIVED_FROM_P (qualifying_class, current_class_type))
|
||||
expr = (build_class_member_access_expr
|
||||
(maybe_dummy_object (qualifying_class, NULL),
|
||||
@ -2646,7 +2643,8 @@ finish_id_expression (tree id_expression,
|
||||
mark_used (first_fn);
|
||||
|
||||
if (TREE_CODE (first_fn) == FUNCTION_DECL
|
||||
&& DECL_NONSTATIC_MEMBER_FUNCTION_P (first_fn))
|
||||
&& DECL_FUNCTION_MEMBER_P (first_fn)
|
||||
&& !shared_member_p (decl))
|
||||
{
|
||||
/* A set of member functions. */
|
||||
decl = maybe_dummy_object (DECL_CONTEXT (first_fn), 0);
|
||||
|
Loading…
Reference in New Issue
Block a user