[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 19 05:42:03 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/Interp/Integral.h:173
+  }
+
   template <bool SrcSign> static Integral from(Integral<0, SrcSign> Value) {
----------------
tbaeder wrote:
> aaron.ballman wrote:
> > tbaeder wrote:
> > > I'm a bit out of my element with the template magic here.
> > It mostly looks correct to me, but the part I'm struggling with is `static_cast<Integral::T>`; can you explain what you're trying to do there?
> I was trying to implement creating an Integral from a Boolean; the `static_cast` casts to `Integral::T` (which in my case is `int`). It might not be needed.
Oh!!! I see now why there's so much confusion. You have `template <typename T>` and I was wondering why you were trying to use that here. I see now that there's `Integral::T` as a private member.

Can we please rename `Integral::T` to be something mildly descriptive? (I'm fine if that's done in a follow-up as an NFC change.)


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

https://reviews.llvm.org/D132098



More information about the cfe-commits mailing list