[PATCH] D135177: [clang] adds `__is_scoped_enum`, `__is_nullptr`, and `__is_referenceable`
Christopher Di Bella via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 10 09:54:20 PDT 2022
cjdb added inline comments.
================
Comment at: clang/lib/Parse/ParseExpr.cpp:1071
REVERTIBLE_TYPE_TRAIT(__is_base_of);
+ REVERTIBLE_TYPE_TRAIT(__is_bounded_array);
REVERTIBLE_TYPE_TRAIT(__is_class);
----------------
erichkeane wrote:
> Can you just put this in the right place in the other commit?
Yeah, this feels like a commit split issue. Thanks for catching.
================
Comment at: clang/test/SemaCXX/type-traits.cpp:374
+void is_scoped_enum() {
+ static_assert(!__is_scoped_enum(Enum), "");
----------------
aaron.ballman wrote:
> It'd probably not be a bad idea at some point to add test coverage for incomplete types.
I've added that coverage for `__is_enum` above too.
================
Comment at: clang/test/SemaCXX/type-traits.cpp:822
+
+ { int a[F(__is_referenceable(void))]; }
+}
----------------
aaron.ballman wrote:
> I think we should have test cases for the following:
> ```
> struct incomplete;
>
> __is_referenceable(struct incomplete); // Also interesting to make sure we handle elaborated type specifiers properly
>
> typedef void function_type(int);
> __is_referenceable(function_type); // Note, this is not a function *pointer* type
>
> struct S {
> void func1() &;
> void func2() const;
> };
>
> // Both of these should be false, by my understanding of what "referenceable" means in the standard.
> __is_referenceable(decltype(&S::func1));
> __is_referenceable(decltype(&S::func2));
> ```
I think the latter two are pointer-to-member functions, which are referenceable. We want to check `void(int) const`, which is done on the last green line of this file.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135177/new/
https://reviews.llvm.org/D135177
More information about the cfe-commits
mailing list