@@ -5630,7 +5630,8 @@ static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT, const TypeSourceI
5630
5630
static ExprResult CheckConvertibilityForTypeTraits (Sema &Self,
5631
5631
const TypeSourceInfo *Lhs,
5632
5632
const TypeSourceInfo *Rhs,
5633
- SourceLocation KeyLoc) {
5633
+ SourceLocation KeyLoc,
5634
+ llvm::BumpPtrAllocator & OpaqueExprAllocator) {
5634
5635
5635
5636
QualType LhsT = Lhs->getType ();
5636
5637
QualType RhsT = Rhs->getType ();
@@ -5675,9 +5676,9 @@ static ExprResult CheckConvertibilityForTypeTraits(Sema &Self,
5675
5676
5676
5677
// Build a fake source and destination for initialization.
5677
5678
InitializedEntity To (InitializedEntity::InitializeTemporary (RhsT));
5678
- OpaqueValueExpr From (KeyLoc, LhsT.getNonLValueExprType (Self.Context ),
5679
+ Expr* From = new (OpaqueExprAllocator.Allocate <OpaqueValueExpr>())
5680
+ OpaqueValueExpr (KeyLoc, LhsT.getNonLValueExprType (Self.Context ),
5679
5681
Expr::getValueKindForType (LhsT));
5680
- Expr *FromPtr = &From;
5681
5682
InitializationKind Kind =
5682
5683
InitializationKind::CreateCopy (KeyLoc, SourceLocation ());
5683
5684
@@ -5687,11 +5688,11 @@ static ExprResult CheckConvertibilityForTypeTraits(Sema &Self,
5687
5688
Self, Sema::ExpressionEvaluationContext::Unevaluated);
5688
5689
Sema::SFINAETrap SFINAE (Self, /* AccessCheckingSFINAE=*/ true );
5689
5690
Sema::ContextRAII TUContext (Self, Self.Context .getTranslationUnitDecl ());
5690
- InitializationSequence Init (Self, To, Kind, FromPtr );
5691
+ InitializationSequence Init (Self, To, Kind, From );
5691
5692
if (Init.Failed ())
5692
5693
return ExprError ();
5693
5694
5694
- ExprResult Result = Init.Perform (Self, To, Kind, FromPtr );
5695
+ ExprResult Result = Init.Perform (Self, To, Kind, From );
5695
5696
if (Result.isInvalid () || SFINAE.hasErrorOccurred ())
5696
5697
return ExprError ();
5697
5698
@@ -5819,7 +5820,7 @@ static bool EvaluateBooleanTypeTrait(Sema &S, TypeTrait Kind,
5819
5820
S.Context .getPointerType (T.getNonReferenceType ()));
5820
5821
TypeSourceInfo *UPtr = S.Context .CreateTypeSourceInfo (
5821
5822
S.Context .getPointerType (U.getNonReferenceType ()));
5822
- return !CheckConvertibilityForTypeTraits (S, UPtr, TPtr, RParenLoc)
5823
+ return !CheckConvertibilityForTypeTraits (S, UPtr, TPtr, RParenLoc, OpaqueExprAllocator )
5823
5824
.isInvalid ();
5824
5825
}
5825
5826
@@ -6028,9 +6029,9 @@ static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT, const TypeSourceI
6028
6029
case BTT_IsNothrowConvertible: {
6029
6030
if (RhsT->isVoidType ())
6030
6031
return LhsT->isVoidType ();
6031
-
6032
+ llvm::BumpPtrAllocator OpaqueExprAllocator;
6032
6033
ExprResult Result =
6033
- CheckConvertibilityForTypeTraits (Self, Lhs, Rhs, KeyLoc);
6034
+ CheckConvertibilityForTypeTraits (Self, Lhs, Rhs, KeyLoc, OpaqueExprAllocator );
6034
6035
if (Result.isInvalid ())
6035
6036
return false ;
6036
6037
0 commit comments