cp-tree.h (constructor_name_p): Declare it.
* cp-tree.h (constructor_name_p): Declare it. (check_template_template_default_arg): Likewise. * class.c (handle_using_decl): Use constructor_name_p. * decl.c (grokdeclarator): Likewise. * decl2.c (constructor_name_p): Define it. * init.c (build_member_call): Use constructor_name_p. * parse.y (template_parm): Use check_template_template_default_arg. * pt.c (check_explicit_specialization): Use constructor_name_p. * semantics.c (check_template_template_default_arg): New function. From-SVN: r55350
This commit is contained in:
parent
2fefbb5dbc
commit
8ba658eea5
@ -1,3 +1,15 @@
|
||||
2002-07-09 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* cp-tree.h (constructor_name_p): Declare it.
|
||||
(check_template_template_default_arg): Likewise.
|
||||
* class.c (handle_using_decl): Use constructor_name_p.
|
||||
* decl.c (grokdeclarator): Likewise.
|
||||
* decl2.c (constructor_name_p): Define it.
|
||||
* init.c (build_member_call): Use constructor_name_p.
|
||||
* parse.y (template_parm): Use check_template_template_default_arg.
|
||||
* pt.c (check_explicit_specialization): Use constructor_name_p.
|
||||
* semantics.c (check_template_template_default_arg): New function.
|
||||
|
||||
2002-07-08 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
|
||||
* pt.c (can_complete_type_without_circularity): Add static to
|
||||
|
@ -1212,14 +1212,12 @@ handle_using_decl (using_decl, t)
|
||||
if (! binfo)
|
||||
return;
|
||||
|
||||
if (name == constructor_name (ctype)
|
||||
|| name == constructor_name_full (ctype))
|
||||
if (constructor_name_p (name, ctype))
|
||||
{
|
||||
cp_error_at ("`%D' names constructor", using_decl);
|
||||
return;
|
||||
}
|
||||
if (name == constructor_name (t)
|
||||
|| name == constructor_name_full (t))
|
||||
if (constructor_name_p (name, t))
|
||||
{
|
||||
cp_error_at ("`%D' invalid in `%T'", using_decl, t);
|
||||
return;
|
||||
|
@ -3926,6 +3926,7 @@ extern tree grokoptypename PARAMS ((tree, tree));
|
||||
extern void cplus_decl_attributes PARAMS ((tree *, tree, int));
|
||||
extern tree constructor_name_full PARAMS ((tree));
|
||||
extern tree constructor_name PARAMS ((tree));
|
||||
extern bool constructor_name_p (tree, tree);
|
||||
extern void defer_fn PARAMS ((tree));
|
||||
extern void finish_anon_union PARAMS ((tree));
|
||||
extern tree finish_table PARAMS ((tree, tree, tree, int));
|
||||
@ -4318,7 +4319,7 @@ extern void setup_vtbl_ptr PARAMS ((tree, tree));
|
||||
extern void clear_out_block PARAMS ((void));
|
||||
extern tree begin_global_stmt_expr PARAMS ((void));
|
||||
extern tree finish_global_stmt_expr PARAMS ((tree));
|
||||
|
||||
extern tree check_template_template_default_arg (tree);
|
||||
|
||||
/* in spew.c */
|
||||
extern void init_spew PARAMS ((void));
|
||||
|
@ -9848,10 +9848,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
|
||||
if (ctype
|
||||
&& TREE_OPERAND (decl, 0)
|
||||
&& (TREE_CODE (TREE_OPERAND (decl, 0)) == TYPE_DECL
|
||||
&& ((DECL_NAME (TREE_OPERAND (decl, 0))
|
||||
== constructor_name_full (ctype))
|
||||
|| (DECL_NAME (TREE_OPERAND (decl, 0))
|
||||
== constructor_name (ctype)))))
|
||||
&& constructor_name_p (DECL_NAME (TREE_OPERAND (decl, 0)),
|
||||
ctype)))
|
||||
TREE_OPERAND (decl, 0) = constructor_name (ctype);
|
||||
next = &TREE_OPERAND (decl, 0);
|
||||
decl = *next;
|
||||
@ -9958,10 +9956,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
|
||||
}
|
||||
|
||||
if (ctype && TREE_CODE (TREE_OPERAND (decl, 1)) == TYPE_DECL
|
||||
&& ((DECL_NAME (TREE_OPERAND (decl, 1))
|
||||
== constructor_name_full (ctype))
|
||||
|| (DECL_NAME (TREE_OPERAND (decl, 1))
|
||||
== constructor_name (ctype))))
|
||||
&& constructor_name_p (DECL_NAME (TREE_OPERAND (decl, 1)),
|
||||
ctype))
|
||||
TREE_OPERAND (decl, 1) = constructor_name (ctype);
|
||||
next = &TREE_OPERAND (decl, 1);
|
||||
decl = *next;
|
||||
@ -9975,8 +9971,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
|
||||
}
|
||||
else if (TREE_CODE (decl) == BIT_NOT_EXPR
|
||||
&& TREE_CODE (TREE_OPERAND (decl, 0)) == IDENTIFIER_NODE
|
||||
&& (constructor_name (ctype) == TREE_OPERAND (decl, 0)
|
||||
|| constructor_name_full (ctype) == TREE_OPERAND (decl, 0)))
|
||||
&& constructor_name_p (TREE_OPERAND (decl, 0),
|
||||
ctype))
|
||||
{
|
||||
sfk = sfk_destructor;
|
||||
ctor_return_type = ctype;
|
||||
|
@ -1810,6 +1810,16 @@ constructor_name (thing)
|
||||
return thing;
|
||||
return t;
|
||||
}
|
||||
|
||||
/* Returns TRUE if NAME is the name for the constructor for TYPE. */
|
||||
|
||||
bool
|
||||
constructor_name_p (tree name, tree type)
|
||||
{
|
||||
return (name == constructor_name (type)
|
||||
|| name == constructor_name_full (type));
|
||||
}
|
||||
|
||||
|
||||
/* Defer the compilation of the FN until the end of compilation. */
|
||||
|
||||
|
@ -1522,8 +1522,7 @@ build_member_call (type, name, parmlist)
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
if (method_name == constructor_name (type)
|
||||
|| method_name == constructor_name_full (type))
|
||||
if (constructor_name_p (method_name, type))
|
||||
return build_functional_cast (type, parmlist);
|
||||
if (lookup_fnfields (basetype_path, method_name, 0))
|
||||
return build_method_call (decl,
|
||||
|
@ -710,14 +710,7 @@ template_parm:
|
||||
{ $$ = build_tree_list (NULL_TREE, $1); }
|
||||
| template_template_parm '=' template_arg
|
||||
{
|
||||
if (TREE_CODE ($3) != TEMPLATE_DECL
|
||||
&& TREE_CODE ($3) != TEMPLATE_TEMPLATE_PARM
|
||||
&& TREE_CODE ($3) != TYPE_DECL
|
||||
&& TREE_CODE ($3) != UNBOUND_CLASS_TEMPLATE)
|
||||
{
|
||||
error ("invalid default template argument");
|
||||
$3 = error_mark_node;
|
||||
}
|
||||
$3 = check_template_template_default_arg ($3);
|
||||
$$ = build_tree_list ($3, $1);
|
||||
}
|
||||
;
|
||||
|
@ -1529,8 +1529,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
|
||||
tree fns = NULL_TREE;
|
||||
int idx;
|
||||
|
||||
if (name == constructor_name (ctype)
|
||||
|| name == constructor_name_full (ctype))
|
||||
if (constructor_name_p (name, ctype))
|
||||
{
|
||||
int is_constructor = DECL_CONSTRUCTOR_P (decl);
|
||||
|
||||
|
@ -1625,6 +1625,25 @@ finish_template_template_parm (aggr, identifier)
|
||||
return finish_template_type_parm (aggr, tmpl);
|
||||
}
|
||||
|
||||
/* ARGUMENT is the default-argument value for a template template
|
||||
parameter. If ARGUMENT is invalid, issue error messages and return
|
||||
the ERROR_MARK_NODE. Otherwise, ARGUMENT itself is returned. */
|
||||
|
||||
tree
|
||||
check_template_template_default_arg (tree argument)
|
||||
{
|
||||
if (TREE_CODE (argument) != TEMPLATE_DECL
|
||||
&& TREE_CODE (argument) != TEMPLATE_TEMPLATE_PARM
|
||||
&& TREE_CODE (argument) != TYPE_DECL
|
||||
&& TREE_CODE (argument) != UNBOUND_CLASS_TEMPLATE)
|
||||
{
|
||||
error ("invalid default template argument");
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
/* Finish a parameter list, indicated by PARMS. If ELLIPSIS is
|
||||
non-zero, the parameter list was terminated by a `...'. */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user