[PATCH] D135341: adds `__reference_constructs_from_temporary`

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 12 22:46:46 PDT 2023


cor3ntin 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:
> 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)


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