pt.c (tsubst_expr, DECL_STMT): Instantiate decl's type.
cp: * pt.c (tsubst_expr, DECL_STMT): Instantiate decl's type. testsuite: * g++.old-deja/g++.pt/instantiate8.C: New test. From-SVN: r37518
This commit is contained in:
parent
5cce22b6c2
commit
35728a80fc
@ -1,3 +1,7 @@
|
||||
2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* pt.c (tsubst_expr, DECL_STMT): Instantiate decl's type.
|
||||
|
||||
2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* cp-tree.h (PARMLIST_ELLIPSIS_P): New macro.
|
||||
|
@ -7150,6 +7150,9 @@ tsubst_expr (t, args, complain, in_decl)
|
||||
init = tsubst_expr (init, args, complain, in_decl);
|
||||
if (decl != error_mark_node)
|
||||
{
|
||||
if (TREE_CODE (decl) != TYPE_DECL)
|
||||
/* Make sure the type is instantiated now. */
|
||||
complete_type (type);
|
||||
if (init)
|
||||
DECL_INITIAL (decl) = error_mark_node;
|
||||
/* By marking the declaration as instantiated, we avoid
|
||||
|
@ -1,3 +1,7 @@
|
||||
2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* g++.old-deja/g++.pt/instantiate8.C: New test.
|
||||
|
||||
2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* g++.old-deja/g++.other/incomplete.C: Add more tests.
|
||||
|
40
gcc/testsuite/g++.old-deja/g++.pt/instantiate8.C
Normal file
40
gcc/testsuite/g++.old-deja/g++.pt/instantiate8.C
Normal file
@ -0,0 +1,40 @@
|
||||
// Build don't link:
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 14 Nov 2000 <nathan@codesourcery.com>
|
||||
|
||||
// bug 616. We failed to complete the type of decls in templates, leading to
|
||||
// bogus errors.
|
||||
|
||||
struct Z;
|
||||
struct Y
|
||||
{
|
||||
Y (int i = 1);
|
||||
};
|
||||
void g ()
|
||||
{
|
||||
const Y y;
|
||||
Z z; // ERROR - incomplete
|
||||
}
|
||||
|
||||
template <int dim>
|
||||
struct X
|
||||
{
|
||||
X (int i=1);
|
||||
};
|
||||
|
||||
void h ()
|
||||
{
|
||||
const X<2> z;
|
||||
Z z1; // ERROR - incomplete
|
||||
}
|
||||
|
||||
template <int dim>
|
||||
void f()
|
||||
{
|
||||
const X<dim> x;
|
||||
const X<dim+1> y[3];
|
||||
Z z2; // ERROR - incomplete
|
||||
typedef Z z3; // ok
|
||||
};
|
||||
|
||||
template void f<3> ();
|
Loading…
Reference in New Issue
Block a user