[PATCH] D135177: [clang] adds `__is_scoped_enum`, `__is_nullptr`, and `__is_referenceable`
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 10 10:27:47 PDT 2022
aaron.ballman accepted this revision.
aaron.ballman added a comment.
LGTM
================
Comment at: clang/test/SemaCXX/type-traits.cpp:822
+
+ { int a[F(__is_referenceable(void))]; }
+}
----------------
aaron.ballman wrote:
> cjdb wrote:
> > 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.
> Do you have a test for:
> ```
> 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));
> ```
>
Ah thank you for showing me we already had the coverage!
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