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