Pull in r213790 from upstream clang trunk (by Richard Smith):

PR20228: don't retain a pointer to a vector element after the
  container has been resized.

This fixes a possible crash when compiling certain parts of libc++'s
type_traits header.
This commit is contained in:
Dimitry Andric 2015-01-01 22:44:02 +00:00
parent 44d29d4762
commit f9d068d10d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=276516

View File

@ -3642,12 +3642,13 @@ static bool evaluateTypeTrait(Sema &S, TypeTrait Kind, SourceLocation KWLoc,
if (T->isObjectType() || T->isFunctionType())
T = S.Context.getRValueReferenceType(T);
OpaqueArgExprs.push_back(
OpaqueValueExpr(Args[I]->getTypeLoc().getLocStart(),
OpaqueValueExpr(Args[I]->getTypeLoc().getLocStart(),
T.getNonLValueExprType(S.Context),
Expr::getValueKindForType(T)));
ArgExprs.push_back(&OpaqueArgExprs.back());
}
for (Expr &E : OpaqueArgExprs)
ArgExprs.push_back(&E);
// Perform the initialization in an unevaluated context within a SFINAE
// trap at translation unit scope.
EnterExpressionEvaluationContext Unevaluated(S, Sema::Unevaluated);