[PATCH] D122083: [Concepts] Fix placeholder constraints when references are involved

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 07:02:28 PDT 2022


erichkeane accepted this revision.
erichkeane added a comment.
This revision is now accepted and ready to land.

In D122083#3402440 <https://reviews.llvm.org/D122083#3402440>, @royjacobson wrote:

> In D122083#3402289 <https://reviews.llvm.org/D122083#3402289>, @erichkeane wrote:
>
>> Can you add some tests for the OTHER forms of 'auto' as well?  We have `decltype(auto)` and `auto_type`, and I want to make sure whatever we do with those 'looks right'.
>
> Can we have constraints on `__auto_type`? As far as I understand it, it's a C extension with very limited C++ support.

I tried a couple and cannot convince GCC to let me deduce it.

> About decltype(auto) - we can't have `*`/`&` modifiers with it, and that's already covered by tests like p7-cxx14.

Ah, right, thanks!

> So (I think?) it's always invalid code and it fails earlier during parsing.

Yep, thanks for that.

1 more test I'd like to see that doesn't seem covered (ref to ptr), AND according to @aaron.ballman we need "Release Notes" for this.  Otherwise LGTM.  Do you have commit rights yet?



================
Comment at: clang/test/SemaTemplate/concepts.cpp:207
   }
-  C auto *f2() {
-    return (int*)nullptr; // FIXME: should error
+  C auto *f2() { // expected-error {{deduced type 'int' does not satisfy 'C'}}
+    return (int*)nullptr;
----------------
would also like `C auto*&`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122083



More information about the cfe-commits mailing list