diff options
author | Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu> | 1998-05-26 23:54:23 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-05-26 19:54:23 -0400 |
commit | 410c2fbabecdcb3d9420565583e690deb36e31c3 (patch) | |
tree | 85912eb632acb6f881772512229ee37ae5b5ded8 | |
parent | 8da801cf85dfcafdba58a78881117617def25af8 (diff) | |
download | gcc-410c2fbabecdcb3d9420565583e690deb36e31c3.zip gcc-410c2fbabecdcb3d9420565583e690deb36e31c3.tar.gz gcc-410c2fbabecdcb3d9420565583e690deb36e31c3.tar.bz2 |
pt.c (process_template_parm): Accept TYPENAME_TYPE nodes.
* pt.c (process_template_parm): Accept TYPENAME_TYPE nodes.
(convert_nontype_argument): Handle cases when nontype template
parameters become classes after substitution.
From-SVN: r20084
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 11 |
2 files changed, 15 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f1249c8..2097bbf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +1998-05-26 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu> + + * pt.c (process_template_parm): Accept TYPENAME_TYPE nodes. + (convert_nontype_argument): Handle cases when nontype template + parameters become classes after substitution. + 1998-05-26 Mark Mitchell <mark@markmitchell.com> * friend.c (is_friend): Use comptypes, rather than == to compare diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index dd7060a..509aa15 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1382,7 +1382,8 @@ process_template_parm (list, next) /* A template parameter is not modifiable. */ TREE_READONLY (parm) = 1; if (IS_AGGR_TYPE (TREE_TYPE (parm)) - && TREE_CODE (TREE_TYPE (parm)) != TEMPLATE_TYPE_PARM) + && TREE_CODE (TREE_TYPE (parm)) != TEMPLATE_TYPE_PARM + && TREE_CODE (TREE_TYPE (parm)) != TYPENAME_TYPE) { cp_error ("`%#T' is not a valid type for a template constant parameter", TREE_TYPE (parm)); @@ -2232,7 +2233,13 @@ convert_nontype_argument (type, expr) tree fns; tree fn; - my_friendly_assert (TYPE_PTRMEMFUNC_P (type), 0); + if (!TYPE_PTRMEMFUNC_P (type)) + /* This handles templates like + template<class T, T t> void f(); + when T is substituted with any class. The second template + parameter becomes invalid and the template candidate is + rejected. */ + return error_mark_node; /* For a non-type template-parameter of type pointer to member function, no conversions apply. If the template-argument |