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
This commit is contained in:
parent
d8caf48e5c
commit
4b2811e97e
4 changed files with 42 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
|||
2001-01-24 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* 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 <nathan@codesourcery.com>
|
||||
|
||||
* call.c (add_builtin_candidate): Quote std properly, from
|
||||
|
|
21
gcc/cp/pt.c
21
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))
|
||||
{
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2001-01-24 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* g++.old-deja/g++.pt/spec38.C: New test.
|
||||
|
||||
2001-01-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
|
||||
* g++.old-deja/g++.pt/spec33.C: Change from "Build don't link" to
|
||||
|
|
17
gcc/testsuite/g++.old-deja/g++.pt/spec38.C
Normal file
17
gcc/testsuite/g++.old-deja/g++.pt/spec38.C
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Build don't link:
|
||||
//
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 19 Jan 2001 <nathan@codesourcery.com>
|
||||
|
||||
// Bug 1638. We failed to check if a function instantiation produced a void
|
||||
// parameter type.
|
||||
|
||||
template <class T> struct S
|
||||
{
|
||||
int f (T); // ERROR - void type
|
||||
};
|
||||
|
||||
void foo ()
|
||||
{
|
||||
S<void> s;
|
||||
}
|
Loading…
Add table
Reference in a new issue