diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-07-18 03:28:32 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1999-07-18 03:28:32 +0000 |
commit | 91e490abe5516df0bfdbcb63e3f3ed7ce4fdc16c (patch) | |
tree | e07fdae22417edad4c987e360248a27a1c4e2ec1 /gcc/cp | |
parent | 50908fadbb3fa0f2866c9625d8f31d8618567f6e (diff) | |
download | gcc-91e490abe5516df0bfdbcb63e3f3ed7ce4fdc16c.zip gcc-91e490abe5516df0bfdbcb63e3f3ed7ce4fdc16c.tar.gz gcc-91e490abe5516df0bfdbcb63e3f3ed7ce4fdc16c.tar.bz2 |
pt.c (determine_specialization): Tighten error-checking.
* pt.c (determine_specialization): Tighten error-checking.
(end_template_parm_list): Likewise.
From-SVN: r28147
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 33 |
2 files changed, 35 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fdc4b70..090fc86 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 00e17be..6106852 100644 --- a/gcc/cp/pt.c +++ b/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; |