[cfe-dev] How to tell whether two TypeDecls are implicit convertible to each other?

Ray Zhang via cfe-dev cfe-dev at lists.llvm.org
Mon Jun 15 12:15:17 PDT 2020


Hi Miklos,

Thank you so much! I was not aware of the cast kind enums that were
available - this helps me a ton.

- Ray

On Mon, Jun 15, 2020 at 9:04 AM Miklos Vajna <vmiklos at vmiklos.hu> wrote:

> Hi Ray,
>
> On Thu, Jun 11, 2020 at 11:59:18PM -0700, Ray Zhang via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
> > In order to safely change C-style casts to static_cast, we want to be
> able
> > to tell whether two types are convertible to each other.
>
> If you already have access to an ExplicitCastExpr, try using
> getCastKind(): CK_BaseToDerived would be when you can safely replace
> your C cast with a static_cast, I guess.
>
> Regards,
>
> Miklos
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200615/d9e15558/attachment.html>


More information about the cfe-dev mailing list