* cp-tree.h (popclass): Change declaration.
(pop_nested_class): Likewise.
(poplevel_class): Remove declaration.
* call.c (convert_default_argument): Pass no arguments to
popclass.
* class.c (finish_struct_1): Likewise.
(finish_struct): Likewise.
(popclass): Remove argument. Simplify code accordingly.
(pop_nested_class): Likewise.
* decl.c (poplevel_class): Declare it here, and make it static.
(poplevel): Handle class scopes.
(pop_level_class): Don't take an rgument. Simplify.
(pop_everything): Pass no arguments to pop_nested_class.
(cp_finish_decl): Pass no arguments to popclass.
(grokdeclarator): Pass no arguments to pop_nested_class.
(finish_function): Likewise.
* decl2.c (grokfield): Likewise.
(pop_scope): Pass no arguments to popclass.
* lex.c (do_pending_defargs): Pass no arguments to pop_nested_class.
* pt.c (instantiate_class_template): Move call to pushclass, and
document. Pass no arguments to popclass.
(regenerate_decl_from_template): Likewise.
From-SVN: r26454
+1999-04-14 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (popclass): Change declaration.
+ (pop_nested_class): Likewise.
+ (poplevel_class): Remove declaration.
+ * call.c (convert_default_argument): Pass no arguments to
+ popclass.
+ * class.c (finish_struct_1): Likewise.
+ (finish_struct): Likewise.
+ (popclass): Remove argument. Simplify code accordingly.
+ (pop_nested_class): Likewise.
+ * decl.c (poplevel_class): Declare it here, and make it static.
+ (poplevel): Handle class scopes.
+ (pop_level_class): Don't take an rgument. Simplify.
+ (pop_everything): Pass no arguments to pop_nested_class.
+ (cp_finish_decl): Pass no arguments to popclass.
+ (grokdeclarator): Pass no arguments to pop_nested_class.
+ (finish_function): Likewise.
+ * decl2.c (grokfield): Likewise.
+ (pop_scope): Pass no arguments to popclass.
+ * lex.c (do_pending_defargs): Pass no arguments to pop_nested_class.
+ * pt.c (instantiate_class_template): Move call to pushclass, and
+ document. Pass no arguments to popclass.
+ (regenerate_decl_from_template): Likewise.
+
1999-04-14 Jason Merrill <jason@yorick.cygnus.com>
* typeck.c (build_unary_op): Handle taking the address of a unique
(notype_qualified_id): Don't add template declarators here.
Sat Sep 27 16:21:58 1997 Mark Mitchell <mmitchell@usa.net>
+<<<<<<< ChangeLog
+<<<<<<< ChangeLog
+
+ * call.c (add_template_candidate): Add explicit_targs parameter.
+ (build_scoped_method_call): Use it.
+ (build_overload_call_real): Likewise.
+ (build_user_type_conversion_1): Likewise.
+ (build_new_function_call): Likewise.
+ (build_object_call): Likewise.
+ (build_new_op): Likewise.
+ (build_new_method_call): Likewise.
+ (build_new_function_call): Handle TEMPLATE_ID_EXPR.
+ (build_new_method_call): Likewise.
+
+ * class.c (finish_struct_methods): Add specialization pass to
+ determine which methods were specializing which other methods.
+ (instantiate_type): Handle TEMPLATE_ID_EXPR.
+=======
+=======
+>>>>>>> 1.996
* call.c (add_template_candidate): Add explicit_targs parameter.
(build_scoped_method_call): Use it.
* friend.c (do_friend): Don't call pushdecl for template
instantiations.
-
+<<<<<<< ChangeLog
+>>>>>>> 1.988
+=======
+>>>>>>> 1.996
+
+<<<<<<< ChangeLog
+<<<<<<< ChangeLog
+ * init.c (build_member_call): Handle TEMPLATE_ID_EXPR.
+
+ * lang-options.h: Add -fname-mangling-version, -fguiding-decls,
+=======
+=======
+>>>>>>> 1.996
* init.c (build_member_call): Handle TEMPLATE_ID_EXPR.
* lang-options.h: Add -fname-mangling-version, -fguiding-decls,
and -fno-guiding-decls.
+<<<<<<< ChangeLog
+<<<<<<< ChangeLog
+
+ * lex.c (identifier_type): Return PFUNCNAME for template function
+ names.
+=======
+=======
+>>>>>>> 1.996
* lex.c (identifier_type): Return PFUNCNAME for template function
names.
arg = tsubst_expr (arg, DECL_TI_ARGS (fn), /*complain=*/1, NULL_TREE);
if (DECL_CLASS_SCOPE_P (fn))
- popclass (1);
+ popclass ();
/* Make sure the default argument is reasonable. */
arg = check_default_argument (type, arg);
cp_error ("redefinition of `%#T'", t);
else
my_friendly_abort (172);
- popclass (1);
+ popclass ();
return t;
}
TYPE_BEING_DEFINED (t) = 0;
if (current_class_type)
- popclass (1);
+ popclass ();
else
error ("trying to finish struct, but kicked out due to previous parse errors.");
}
/* Get out of the current class scope. If we were in a class scope
- previously, that is the one popped to. The flag MODIFY tells whether
- the current scope declarations needs to be modified as a result of
- popping to the previous scope. 0 is used for class definitions. */
+ previously, that is the one popped to. */
void
-popclass (modify)
- int modify;
+popclass ()
{
- if (modify)
- {
- /* Just remove from this class what didn't make
+ /* Just remove from this class what didn't make
it into IDENTIFIER_CLASS_VALUE. */
- tree tags = CLASSTYPE_TAGS (current_class_type);
+ tree tags = CLASSTYPE_TAGS (current_class_type);
- while (tags)
- {
- TREE_NONLOCAL_FLAG (TREE_VALUE (tags)) = 0;
- tags = TREE_CHAIN (tags);
- }
+ while (tags)
+ {
+ TREE_NONLOCAL_FLAG (TREE_VALUE (tags)) = 0;
+ tags = TREE_CHAIN (tags);
}
- /* Force clearing of IDENTIFIER_CLASS_VALUEs after a class definition,
- since not all class decls make it there currently. */
- poplevel_class (! modify);
-
+ poplevel (1, 0, 0);
/* Since poplevel_class does the popping of class decls nowadays,
- this really only frees the obstack used for these decls.
- That's why it had to be moved down here. */
- if (modify)
- pop_class_decls ();
+ this really only frees the obstack used for these decls. */
+ pop_class_decls ();
current_class_depth--;
current_class_name = current_class_stack[current_class_depth].name;
/* Undoes a push_nested_class call. MODIFY is passed on to popclass. */
void
-pop_nested_class (modify)
- int modify;
+pop_nested_class ()
{
tree context = DECL_CONTEXT (TYPE_MAIN_DECL (current_class_type));
- popclass (modify);
+ popclass ();
if (context && TREE_CODE (context) == RECORD_TYPE)
- pop_nested_class (modify);
+ pop_nested_class ();
}
/* Set global variables CURRENT_LANG_NAME to appropriate value
extern void init_class_processing PROTO((void));
extern int is_empty_class PROTO((tree));
extern void pushclass PROTO((tree, int));
-extern void popclass PROTO((int));
+extern void popclass PROTO((void));
extern void push_nested_class PROTO((tree, int));
-extern void pop_nested_class PROTO((int));
+extern void pop_nested_class PROTO((void));
extern void push_lang_context PROTO((tree));
extern void pop_lang_context PROTO((void));
extern tree instantiate_type PROTO((tree, tree, int));
extern void add_block_current_level PROTO((tree));
extern void set_block PROTO((tree));
extern void pushlevel_class PROTO((void));
-extern tree poplevel_class PROTO((int));
extern void print_binding_stack PROTO((void));
extern void print_binding_level PROTO((struct binding_level *));
extern void push_namespace PROTO((tree));
static const char *tag_name PROTO((enum tag_types code));
static void find_class_binding_level PROTO((void));
static struct binding_level *innermost_nonclass_level PROTO((void));
+static tree poplevel_class PROTO((void));
#if defined (DEBUG_CP_BINDING_LEVELS)
static void indent PROTO((void));
int block_previously_created;
int leaving_for_scope;
- if (current_binding_level->parm_flag == 2
- || current_binding_level->class_shadowed)
- /* We should not be using poplevel to pop a class binding level.
- Use poplevel_class instead. */
- my_friendly_abort (0);
+ if (current_binding_level->parm_flag == 2)
+ return poplevel_class ();
+
+ my_friendly_assert (!current_binding_level->class_shadowed,
+ 19990414);
/* We used to use KEEP == 2 to indicate that the new block should go
at the beginning of the list of blocks at this binding level,
class_binding_level->parm_flag = 2;
}
-/* ...and a poplevel for class declarations. FORCE is used to force
- clearing out of CLASS_VALUEs after a class definition. */
+/* ...and a poplevel for class declarations. */
-tree
-poplevel_class (force)
- int force;
+static tree
+poplevel_class ()
{
register struct binding_level *level = class_binding_level;
- tree block = NULL_TREE;
tree shadowed;
my_friendly_assert (level != 0, 354);
shouldn't even be used when current_class_type isn't set, and second,
if we don't touch it here, we're able to use the cache effect if the
next time we're entering a class scope, it is the same class. */
- if (current_class_depth != 1 || force)
+ if (current_class_depth != 1)
{
struct binding_level* b;
pop_binding_level ();
- return block;
+ return NULL_TREE;
}
/* We are entering the scope of a class. Clear IDENTIFIER_CLASS_VALUE
while (!toplevel_bindings_p ())
{
if (current_binding_level->parm_flag == 2)
- pop_nested_class (1);
+ pop_nested_class ();
else
poplevel (0, 0, 0);
}
the binding level.. */
&& TYPE_SIZE (context) != NULL_TREE
&& context == current_class_type)
- popclass (1);
+ popclass ();
}
}
push_nested_class used to push into class scope for
parsing the argument list of a function decl, in
qualified_id. */
- pop_nested_class (1);
+ pop_nested_class ();
TREE_COMPLEXITY (declarator) = current_class_depth;
}
else
if (current_class_name)
{
ctype = current_class_type;
- pop_nested_class (1);
+ pop_nested_class ();
}
/* Must mark the RESULT_DECL as being in this function. */
if (! IS_AGGR_TYPE_CODE (TREE_CODE (TREE_OPERAND (declarator, 0))))
;
else if (TREE_COMPLEXITY (declarator) == current_class_depth)
- pop_nested_class (1);
+ pop_nested_class ();
return do_class_using_decl (declarator);
}
if (TREE_CODE (t) == NAMESPACE_DECL)
pop_decl_namespace ();
else
- popclass (1);
+ popclass ();
}
/* [basic.lookup.koenig] */
}
poplevel (0, 0, 0);
- pop_nested_class (1);
+ pop_nested_class ();
}
}
TYPE_BEING_DEFINED (type) = 1;
maybe_push_to_top_level (uses_template_parms (type));
- pushclass (type, 0);
if (t)
{
base_list);
}
+ /* Now that our base classes are set up, enter the scope of the
+ class, so that name lookups into base classes, etc. will work
+ corectly. This is precisely analagous to what we do in
+ begin_class_definition when defining an ordinary non-template
+ class. */
+ pushclass (type, 1);
+
for (t = CLASSTYPE_TAGS (pattern); t; t = TREE_CHAIN (t))
{
tree tag = TREE_VALUE (t);
TYPE_BEING_DEFINED (type) = 0;
repo_template_used (type);
- popclass (0);
+ popclass ();
pop_from_top_level ();
pop_tinst_level ();
tsubst_expr (DECL_INITIAL (code_pattern), args,
/*complain=*/1, DECL_TI_TEMPLATE (decl));
/* Pop the class context we pushed above. */
- popclass (1);
+ popclass ();
}
else if (TREE_CODE (decl) == FUNCTION_DECL)
{