forked from OSchip/llvm-project
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:
parent
bb69c94798
commit
f343fd8929
|
@ -188,7 +188,10 @@ public:
|
||||||
return this;
|
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;
|
const char *getStmtClassName() const;
|
||||||
|
|
||||||
/// SourceLocation tokens are not useful in isolation - they are low level
|
/// SourceLocation tokens are not useful in isolation - they are low level
|
||||||
|
|
|
@ -3414,6 +3414,7 @@ Sema::DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
|
||||||
TemplateId->getTemplateArgLocations(),
|
TemplateId->getTemplateArgLocations(),
|
||||||
TemplateArgs);
|
TemplateArgs);
|
||||||
HasExplicitTemplateArgs = true;
|
HasExplicitTemplateArgs = true;
|
||||||
|
TemplateArgsPtr.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
// C++ [temp.explicit]p1:
|
// C++ [temp.explicit]p1:
|
||||||
|
|
|
@ -69,3 +69,7 @@ template void print_type<int>(float*); // expected-error{{does not refer}}
|
||||||
|
|
||||||
void print_type(double*);
|
void print_type(double*);
|
||||||
template void print_type<double>(double*);
|
template void print_type<double>(double*);
|
||||||
|
|
||||||
|
// PR5069
|
||||||
|
template<int I> void foo0 (int (&)[I + 1]) { }
|
||||||
|
template void foo0<2> (int (&)[3]);
|
||||||
|
|
Loading…
Reference in New Issue