mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-23 19:03:59 +08:00
pt.c (determine_specialization): Tighten error-checking.
* pt.c (determine_specialization): Tighten error-checking. (end_template_parm_list): Likewise. From-SVN: r28147
This commit is contained in:
parent
50908fadbb
commit
91e490abe5
@ -1,3 +1,8 @@
|
||||
1999-07-17 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* pt.c (determine_specialization): Tighten error-checking.
|
||||
(end_template_parm_list): Likewise.
|
||||
|
||||
1999-07-14 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* pt.c (check_default_tmpl_args): Handle friends defined in the
|
||||
|
33
gcc/cp/pt.c
33
gcc/cp/pt.c
@ -974,9 +974,15 @@ determine_specialization (template_id, decl, targs_out,
|
||||
return error_mark_node;
|
||||
|
||||
/* Check for baselinks. */
|
||||
if (TREE_CODE (fns) == TREE_LIST)
|
||||
if (BASELINK_P (fns))
|
||||
fns = TREE_VALUE (fns);
|
||||
|
||||
if (!is_overloaded_fn (fns))
|
||||
{
|
||||
cp_error ("`%D' is not a function template", fn);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
for (; fns; fns = OVL_NEXT (fns))
|
||||
{
|
||||
tree tmpl;
|
||||
@ -1851,13 +1857,34 @@ end_template_parm_list (parms)
|
||||
int nparms;
|
||||
tree parm;
|
||||
tree saved_parmlist = make_tree_vec (list_length (parms));
|
||||
int seen_def_arg_p = 0;
|
||||
|
||||
current_template_parms
|
||||
= tree_cons (build_int_2 (0, processing_template_decl),
|
||||
saved_parmlist, current_template_parms);
|
||||
|
||||
for (parm = parms, nparms = 0; parm; parm = TREE_CHAIN (parm), nparms++)
|
||||
TREE_VEC_ELT (saved_parmlist, nparms) = parm;
|
||||
for (parm = parms, nparms = 0;
|
||||
parm;
|
||||
parm = TREE_CHAIN (parm), nparms++)
|
||||
{
|
||||
/* [temp.param]
|
||||
|
||||
If a template-parameter has a default template-argument, all
|
||||
subsequent template-parameters shall have a default
|
||||
template-argument supplied. */
|
||||
if (TREE_PURPOSE (parm))
|
||||
seen_def_arg_p = 1;
|
||||
else if (seen_def_arg_p)
|
||||
{
|
||||
/* Issue the error message. */
|
||||
cp_error ("no default argument for `%D'", TREE_VALUE (parm));
|
||||
/* For better subsequent error-recovery, we indicate that
|
||||
there should have been a default argument. */
|
||||
TREE_PURPOSE (parm) = error_mark_node;
|
||||
}
|
||||
|
||||
TREE_VEC_ELT (saved_parmlist, nparms) = parm;
|
||||
}
|
||||
|
||||
--processing_template_parmlist;
|
||||
|
||||
|
@ -5,7 +5,5 @@
|
||||
// by Alexandre Oliva <oliva@dcc.unicamp.br>
|
||||
// simplified from bug report by Meenaradchagan Vishnu <mvishnu@fore.com>
|
||||
|
||||
// crash test - XFAIL *-*-*
|
||||
|
||||
template <typename> struct foo {};
|
||||
template <> void foo();
|
||||
template <> void foo(); // ERROR - bad specialization
|
||||
|
Loading…
Reference in New Issue
Block a user