From: Nathan Sidwell Date: Wed, 24 Jan 2001 11:25:28 +0000 (+0000) Subject: pt.c (tsubst_decl): Remove IN_DECL parameter. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4b2811e97e119fb9fa4372df5bb8d1666cef1aa3;p=gcc.git pt.c (tsubst_decl): Remove IN_DECL parameter. cp: * pt.c (tsubst_decl): Remove IN_DECL parameter. (tsubst_arg_types): Check parameter is not void. (tsubst): Adjust tsubst_decl call. testsuite: * g++.old-deja/g++.pt/spec38.C: New test. From-SVN: r39234 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2dcd54d39e1..69ac61d1032 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2001-01-24 Nathan Sidwell + + * pt.c (tsubst_decl): Remove IN_DECL parameter. + (tsubst_arg_types): Check parameter is not void. + (tsubst): Adjust tsubst_decl call. + 2001-01-24 Nathan Sidwell * call.c (add_builtin_candidate): Quote std properly, from diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 0bed46ec854..be5439c3c51 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -149,7 +149,7 @@ static tree most_specialized_class PARAMS ((tree, tree)); static void set_mangled_name_for_template_decl PARAMS ((tree)); static int template_class_depth_real PARAMS ((tree, int)); static tree tsubst_aggr_type PARAMS ((tree, tree, int, tree, int)); -static tree tsubst_decl PARAMS ((tree, tree, tree, tree)); +static tree tsubst_decl PARAMS ((tree, tree, tree)); static tree tsubst_arg_types PARAMS ((tree, tree, int, tree)); static tree tsubst_function_type PARAMS ((tree, tree, int, tree)); static void check_specialization_scope PARAMS ((void)); @@ -5558,19 +5558,18 @@ tsubst_default_arguments (fn) /* Substitute the ARGS into the T, which is a _DECL. TYPE is the (already computed) substitution of ARGS into TREE_TYPE (T), if - appropriate. Return the result of the substitution. IN_DECL is as - for tsubst. */ + appropriate. Return the result of the substitution. */ static tree -tsubst_decl (t, args, type, in_decl) +tsubst_decl (t, args, type) tree t; tree args; tree type; - tree in_decl; { int saved_lineno; const char *saved_filename; tree r = NULL_TREE; + tree in_decl = t; /* Set the filename and linenumber to improve error-reporting. */ saved_lineno = lineno; @@ -6122,6 +6121,16 @@ tsubst_arg_types (arg_types, args, complain, in_decl) type = tsubst (TREE_VALUE (arg_types), args, complain, in_decl); if (type == error_mark_node) return error_mark_node; + if (VOID_TYPE_P (type)) + { + if (complain) + { + cp_error ("invalid parameter type `%T'", type); + if (in_decl) + cp_error_at ("in declaration `%D'", in_decl); + } + return error_mark_node; + } /* Do array-to-pointer, function-to-pointer conversion, and ignore top-level qualifiers as required. */ @@ -6293,7 +6302,7 @@ tsubst (t, args, complain, in_decl) return error_mark_node; if (DECL_P (t)) - return tsubst_decl (t, args, type, in_decl); + return tsubst_decl (t, args, type); switch (TREE_CODE (t)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a97e893c90f..197e6cab89d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-01-24 Nathan Sidwell + + * g++.old-deja/g++.pt/spec38.C: New test. + 2001-01-23 Kriang Lerdsuwanakij * g++.old-deja/g++.pt/spec33.C: Change from "Build don't link" to diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec38.C b/gcc/testsuite/g++.old-deja/g++.pt/spec38.C new file mode 100644 index 00000000000..a33be54dd13 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec38.C @@ -0,0 +1,17 @@ +// Build don't link: +// +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 19 Jan 2001 + +// Bug 1638. We failed to check if a function instantiation produced a void +// parameter type. + +template struct S +{ + int f (T); // ERROR - void type +}; + +void foo () +{ + S s; +}