Make sure to free the explicit template arguments provided for an

explicit instantiation. Also, tighten up reference-count checking to
help catch these issues earlier. Fixes PR5069.

llvm-svn: 83225
This commit is contained in:
Douglas Gregor 2009-10-01 23:51:25 +00:00
parent bb69c94798
commit f343fd8929
3 changed files with 9 additions and 1 deletions

View File

@ -188,7 +188,10 @@ public:
return this;
}
StmtClass getStmtClass() const { return (StmtClass)sClass; }
StmtClass getStmtClass() const {
assert(RefCount >= 1 && "Referencing already-destroyed statement!");
return (StmtClass)sClass;
}
const char *getStmtClassName() const;
/// SourceLocation tokens are not useful in isolation - they are low level

View File

@ -3414,6 +3414,7 @@ Sema::DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
TemplateId->getTemplateArgLocations(),
TemplateArgs);
HasExplicitTemplateArgs = true;
TemplateArgsPtr.release();
}
// C++ [temp.explicit]p1:

View File

@ -69,3 +69,7 @@ template void print_type<int>(float*); // expected-error{{does not refer}}
void print_type(double*);
template void print_type<double>(double*);
// PR5069
template<int I> void foo0 (int (&)[I + 1]) { }
template void foo0<2> (int (&)[3]);