[PATCH] D116203: [clang] adds unary type transformations as compiler built-ins
Christopher Di Bella via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 13 12:58:22 PDT 2022
cjdb added inline comments.
================
Comment at: clang/test/SemaCXX/type-traits.cpp:3495-3496
+
+ { int a[T(__is_same(make_signed_t<Enum>, int))]; }
+ { int a[T(__is_same(make_signed_t<SignedEnum>, int))]; }
+ { int a[T(__is_same(make_signed_t<const SignedEnum>, const int))]; }
----------------
cjdb wrote:
> rsmith wrote:
> > It'd be useful to test enums with different underlying types. However, this test is not portable: if `short` and `int` are the same size, this is required to produce `short`, not `int`. It'd be good to have some test coverage of that quirk too. Perhaps this is easiest to see with a test like:
> >
> > ```
> > enum E : long long {};
> > static_assert(__is_same(__make_signed(E), long));
> > ```
> >
> > ... which should hold in cases where `long` and `long long` are the same size and are larger than `int`.
> I agree, but what about when `long` is smaller than `int`?
Bleh, this is impossible. What I meant to ask is what happens when `long` and `int` are the same size, I think?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116203/new/
https://reviews.llvm.org/D116203
More information about the cfe-commits
mailing list