cp-tree.h (enter_scope_of): New function.

* cp-tree.h (enter_scope_of): New function.
	* parse.y (complex_direct_notype_declarator): Use it.
	* semantics.c (enter_scope_of): New function.

From-SVN: r21812
This commit is contained in:
Mark Mitchell 1998-08-17 22:33:58 +00:00 committed by Mark Mitchell
parent def9b0064b
commit 648f19f647
6 changed files with 282 additions and 270 deletions

View File

@ -1,3 +1,9 @@
1998-08-17 Mark Mitchell <mark@markmitchell.com>
* cp-tree.h (enter_scope_of): New function.
* parse.y (complex_direct_notype_declarator): Use it.
* semantics.c (enter_scope_of): New function.
1998-08-17 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokparms): No, here.

View File

@ -2962,6 +2962,7 @@ extern void begin_inline_definitions PROTO((void));
extern tree finish_member_class_template PROTO((tree, tree));
extern void finish_template_decl PROTO((tree));
extern tree finish_template_type PROTO((tree, tree, int));
extern void enter_scope_of PROTO((tree));
/* in sig.c */
extern tree build_signature_pointer_type PROTO((tree, int, int));

File diff suppressed because it is too large Load Diff

View File

@ -2818,25 +2818,11 @@ complex_direct_notype_declarator:
| direct_notype_declarator '[' ']'
{ $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
| notype_qualified_id
{ if (TREE_CODE (OP0 ($1)) == NAMESPACE_DECL)
{
push_decl_namespace (OP0 ($1));
TREE_COMPLEXITY ($1) = -1;
}
else if (OP0 ($1) != current_class_type)
{
push_nested_class (OP0 ($1), 3);
TREE_COMPLEXITY ($1) = current_class_depth;
}
}
{ enter_scope_of ($1); }
| nested_name_specifier notype_template_declarator
{ got_scope = NULL_TREE;
$$ = build_parse_node (SCOPE_REF, $1, $2);
if ($1 != current_class_type)
{
push_nested_class ($1, 3);
TREE_COMPLEXITY ($$) = current_class_depth;
}
enter_scope_of ($$);
}
;

View File

@ -1427,3 +1427,24 @@ finish_template_type (name, args, entering_scope)
return decl;
}
/* SR is a SCOPE_REF node. Enter the scope of SR, whether it is a
namespace scope or a class scope. */
void
enter_scope_of (sr)
tree sr;
{
tree scope = TREE_OPERAND (sr, 0);
if (TREE_CODE (scope) == NAMESPACE_DECL)
{
push_decl_namespace (scope);
TREE_COMPLEXITY (sr) = -1;
}
else if (scope != current_class_type)
{
push_nested_class (scope, 3);
TREE_COMPLEXITY (sr) = current_class_depth;
}
}

View File

@ -0,0 +1,12 @@
// Build don't link:
template <class T>
struct S1 {};
namespace N {
}
struct S2
{
typedef N::S1<int> S2_T; // ERROR - parse error
};