Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
f31045fd
Commit
f31045fd
authored
Jul 12, 2004
by
Mark Mitchell
Committed by
Mark Mitchell
Jul 12, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* name-lookup.c (push_class_level_binding): Simplify.
From-SVN: r84585
parent
5e89a381
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
48 deletions
+49
-48
gcc/cp/ChangeLog
+4
-0
gcc/cp/name-lookup.c
+45
-48
No files found.
gcc/cp/ChangeLog
View file @
f31045fd
2004-07-12 Mark Mitchell <mark@codesourcery.com>
* name-lookup.c (push_class_level_binding): Simplify.
2004-07-12 Andrew Pinski <apinski@apple.com>
PR c++/16475
...
...
gcc/cp/name-lookup.c
View file @
f31045fd
...
...
@@ -2820,8 +2820,10 @@ push_class_level_binding (tree name, tree x)
if
(
!
class_binding_level
)
POP_TIMEVAR_AND_RETURN
(
TV_NAME_LOOKUP
,
true
);
/* Make sure that this new member does not have the same name
as a template parameter. */
/* Check for invalid member names, if the class is being defined.
This function is also used to restore IDENTIFIER_CLASS_VALUE,
when reentering the class scope, and there is no point in
checking again at that time. */
if
(
TYPE_BEING_DEFINED
(
current_class_type
))
{
tree
decl
=
x
;
...
...
@@ -2834,40 +2836,41 @@ push_class_level_binding (tree name, tree x)
decl
=
TREE_VALUE
(
decl
);
check_template_shadow
(
decl
);
}
/* [class.mem]
/* [class.mem]
If T is the name of a class, then each of the following shall
have a name different from T:
If T is the name of a class, then each of the following shall
have a name different from T:
-- every static data member of class T;
-- every static data member of class T;
-- every member of class T that is itself a type;
-- every member of class T that is itself a type;
-- every enumerator of every member of class T that is an
enumerated type;
-- every enumerator of every member of class T that is an
enumerated type;
-- every member of every anonymous union that is a member of
class T.
-- every member of every anonymous union that is a member of
class T.
(Non-static data members were also forbidden to have the same
name as T until TC1.) */
if
((
TREE_CODE
(
x
)
==
VAR_DECL
||
TREE_CODE
(
x
)
==
CONST_DECL
||
(
TREE_CODE
(
x
)
==
TYPE_DECL
&&
!
DECL_SELF_REFERENCE_P
(
x
))
/* A data member of an anonymous union. */
||
(
TREE_CODE
(
x
)
==
FIELD_DECL
&&
DECL_CONTEXT
(
x
)
!=
current_class_type
))
&&
DECL_NAME
(
x
)
==
constructor_name
(
current_class_type
))
{
tree
scope
=
context_for_name_lookup
(
x
);
if
(
TYPE_P
(
scope
)
&&
same_type_p
(
scope
,
current_class_type
))
(Non-static data members were also forbidden to have the same
name as T until TC1.) */
if
((
TREE_CODE
(
x
)
==
VAR_DECL
||
TREE_CODE
(
x
)
==
CONST_DECL
||
(
TREE_CODE
(
x
)
==
TYPE_DECL
&&
!
DECL_SELF_REFERENCE_P
(
x
))
/* A data member of an anonymous union. */
||
(
TREE_CODE
(
x
)
==
FIELD_DECL
&&
DECL_CONTEXT
(
x
)
!=
current_class_type
))
&&
DECL_NAME
(
x
)
==
constructor_name
(
current_class_type
))
{
error
(
"`%D' has the same name as the class in which it is declared"
,
x
);
POP_TIMEVAR_AND_RETURN
(
TV_NAME_LOOKUP
,
false
);
tree
scope
=
context_for_name_lookup
(
x
);
if
(
TYPE_P
(
scope
)
&&
same_type_p
(
scope
,
current_class_type
))
{
error
(
"`%D' has the same name as the class in which it is "
"declared"
,
x
);
POP_TIMEVAR_AND_RETURN
(
TV_NAME_LOOKUP
,
false
);
}
}
}
...
...
@@ -2906,27 +2909,21 @@ push_class_level_binding (tree name, tree x)
else
if
(
TREE_CODE
(
bval
)
==
USING_DECL
&&
is_overloaded_fn
(
x
))
POP_TIMEVAR_AND_RETURN
(
TV_NAME_LOOKUP
,
true
);
if
(
old_decl
)
if
(
old_decl
&&
binding
->
scope
==
class_binding_level
)
{
cp_class_binding
*
cb
;
size_t
i
;
/* Find the previous binding of name on the class-shadowed
list, and update it. */
for
(
i
=
0
;
(
cb
=
VEC_iterate
(
cp_class_binding
,
class_binding_level
->
class_shadowed
,
i
));
++
i
)
if
(
cb
->
identifier
==
name
&&
(
cb
->
base
.
value
==
old_decl
||
cb
->
base
.
type
==
old_decl
))
{
binding
->
value
=
x
;
INHERITED_VALUE_BINDING_P
(
binding
)
=
0
;
IDENTIFIER_CLASS_VALUE
(
name
)
=
x
;
POP_TIMEVAR_AND_RETURN
(
TV_NAME_LOOKUP
,
true
);
}
binding
->
value
=
x
;
/* It is always safe to clear INHERITED_VALUE_BINDING_P
here. That flag is only set when setup_class_bindings
inserts a binding from a base class, and
setup_class_bindings only inserts a binding once for
every name declared in the class and its base classes.
So, if we see a second binding for this name, it must be
coming from a definition in the body of the class
itself. */
INHERITED_VALUE_BINDING_P
(
binding
)
=
0
;
IDENTIFIER_CLASS_VALUE
(
name
)
=
x
;
POP_TIMEVAR_AND_RETURN
(
TV_NAME_LOOKUP
,
true
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment