pt.c (tsubst_decl): If the type of a template instantiation is bogus, so is the whole instantiation.

* pt.c (tsubst_decl): If the type of a template instantiation is
	bogus, so is the whole instantiation.

From-SVN: r29757
This commit is contained in:
Mark Mitchell 1999-10-01 17:25:05 +00:00 committed by Mark Mitchell
parent 2816d1644f
commit b3da7bb1cf
4 changed files with 25 additions and 3 deletions

View File

@ -1,3 +1,8 @@
1999-10-01 Mark Mitchell <mark@codesourcery.com>
* pt.c (tsubst_decl): If the type of a template instantiation is
bogus, so is the whole instantiation.
1999-09-30 Mark Mitchell <mark@codesourcery.com>
* decl.c (initialize_local_var): Handle static variables here.

View File

@ -5778,6 +5778,8 @@ tsubst_decl (t, args, type, in_decl)
ctx = NULL_TREE;
}
type = tsubst (type, args, /*complain=*/1, in_decl);
if (type == error_mark_node)
return error_mark_node;
/* We do NOT check for matching decls pushed separately at this
point, as they may not represent instantiations of this

View File

@ -0,0 +1,15 @@
// Build don't link:
// Origin: Carl Nygard <cnygard@bellatlantic.net>
template <class RT>
class Test { // ERROR - in instantiation
public:
Test(const RT& c = RT()) {} // ERROR - reference to void
};
void f ()
{
Test<void> c; // ERROR - instantiated from here
}

View File

@ -11,7 +11,7 @@ public:
t=_t;
}
anotherT getT() {
anotherT getT() { // ERROR - undefined type
return t;
}
};
@ -20,8 +20,8 @@ class B : public A< B > // ERROR - forward declaration
{
public:
typedef int myT;
};
}; // ERROR - base with non-default constructor
int main() {
B b;
B b; // ERROR - no constructor
}