From aa5f3bad3a1a833d383489c3c4da2c0d6d248680 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Sat, 6 Sep 1997 20:10:05 +0000 Subject: [PATCH] decl.c (replace_defag): Undo previous change. Sat Sep 6 10:20:27 1997 Mark Mitchell * decl.c (replace_defag): Undo previous change. * lex.c (do_pending_defargs): Deal with member templates. * pt.c (is_member_template): Avoid crashing when passed a non-function argument. From-SVN: r15131 --- gcc/cp/ChangeLog | 8 ++++++++ gcc/cp/decl.c | 2 +- gcc/cp/lex.c | 4 ++++ gcc/cp/pt.c | 6 ++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index effd43423c1..f446a4f5947 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +Sat Sep 6 10:20:27 1997 Mark Mitchell + + * decl.c (replace_defag): Undo previous change. + * lex.c (do_pending_defargs): Deal with member templates. + + * pt.c (is_member_template): Avoid crashing when passed a + non-function argument. + Fri Sep 5 17:27:38 1997 Jason Merrill * class.c (grow_method): Remove check for redeclaration. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c77dac80396..1e5a56f40de 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10070,7 +10070,7 @@ void replace_defarg (arg, init) tree arg, init; { - if (! processing_template_decl && ! uses_template_parms (TREE_VALUE (arg)) + if (! processing_template_decl && ! can_convert_arg (TREE_VALUE (arg), TREE_TYPE (init), init)) cp_pedwarn ("invalid type `%T' for default argument to `%T'", TREE_TYPE (init), TREE_VALUE (arg)); diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 7fca8a2138d..471033faf9e 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -1873,6 +1873,8 @@ do_pending_defargs () push_nested_class (TREE_PURPOSE (defarg_fns), 1); pushlevel (0); + if (is_member_template (defarg_fn)) + begin_member_template_processing (DECL_TI_ARGS (defarg_fn)); if (TREE_CODE (defarg_fn) == FUNCTION_DECL) { @@ -1899,6 +1901,8 @@ do_pending_defargs () return; } + if (is_member_template (defarg_fn)) + end_member_template_processing (); poplevel (0, 0, 0); pop_nested_class (1); } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 3620253a6b5..a0154e173ef 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -132,6 +132,12 @@ is_member_template (t) { int r = 0; + if (TREE_CODE (t) != FUNCTION_DECL + && !DECL_FUNCTION_TEMPLATE_P (t)) + /* Anything that isn't a template or a template functon is + certainly not a member template. */ + return 0; + if (DECL_FUNCTION_MEMBER_P (t) || (TREE_CODE (t) == TEMPLATE_DECL && DECL_FUNCTION_MEMBER_P (DECL_TEMPLATE_RESULT (t)))) -- 2.30.2