[PATCH] D134128: Resubmit an implemention for constrained template template parameters [P0857R0 Part B]

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 29 06:18:34 PDT 2022


erichkeane added a comment.

In D134128#3813708 <https://reviews.llvm.org/D134128#3813708>, @lime wrote:

> Well, Something happened after rebasing this patch on D126907 <https://reviews.llvm.org/D126907>. `s41` below was rejected as the constrain generated from `template <C>` was no longer considered to subsume the constrain generated from `template <typename T> requires C` in the template template argument, which is not the case <https://godbolt.org/z/Gq7h58hGb> in both GCC and MSVC. However, GCC and MSVC also accept the redeclaration for `S`, which might be ill-formed because of this rule <https://eel.is/c++draft/temp.decls#temp.over.link-7>. If this kind of redeclaration happens on `X`, GCC and MSVC will reject it. Rebasing this patch on D126907 <https://reviews.llvm.org/D126907> will also not make the both redeclaration valid.
>
> Personally, I decided to make `s41` valid for Clang, a clue might be making the `QualType`s the same in the parameters of two generated constrains.
>
>   template <typename T> concept C = T::f();
>   
>   template <typename T> concept C1 = T::f();
>   
>   template <C> struct X {};
>   
>   template <typename T> requires C<T> struct X; // ill-formed for sure
>   
>   template <C1> struct Y {};
>   
>   template <template <typename T> requires C<T> class> struct S {};
>   
>   template <template <C> class> struct S; // GCC and MSVC accept this
>   
>   S<X> sx; // my target
>   S<Y> sy; // ill-formed for sure

I'm not sure I get the issue here, there are some identifiers you're using that don't make sense to me.  I don't see that test in the lit tests either, could you make sure it is reflected there and commented?  ALso, can you re-arrange the error messages as I requested?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134128



More information about the cfe-commits mailing list