[PATCH] D135341: adds `__reference_constructs_from_temporary`

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 13 09:27:22 PDT 2023


cjdb added inline comments.


================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:5515
+      QualType UPtr = S.BuiltinAddPointer(S.BuiltinRemoveReference(U, UnaryTransformType::RemoveCVRef, {}), {});
+      return EvaluateBinaryTypeTrait(S, TypeTrait::BTT_IsConvertibleTo, UPtr, TPtr, RParenLoc);
     }
----------------
cor3ntin wrote:
> cor3ntin wrote:
> > Could you put the implementation of `BTT_IsConvertibleTo` in its own function?
> I was thinking something like
> 
> ```
> QualType TPtr = S.Context.getPointerType(S.BuiltinRemoveReference(T, UnaryTransformType::RemoveCVRef, {}));
> QualType UPtr = S.Context.getPointerType(S.BuiltinRemoveReference(U, UnaryTransformType::RemoveCVRef, {}));
> return IsConvertibleTo(S, UPtr, TPtr);
> ```
> 
> and then EvaluateBinaryTypeTrait can use this new `IsConvertibleTo` (which we can extract from EvaluateBinaryTypeTrait)
That sounds like an orthogonal change. How about I revert to what was previously there and do that as a second PR? It'll also need a location parameter.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135341/new/

https://reviews.llvm.org/D135341



More information about the cfe-commits mailing list