https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99678

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|c++20 trailing requires     |[concepts] requires-clause
                   |clauses allows undeclared   |allows undeclared
                   |identifier                  |identifier
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
>From PR114946:

(In reply to Nathaniel Shead from comment #0)
> The following sample compiles fine with 'g++ -std=c++20 -pedantic-errors':
> 
>   template <typename T>
>     requires xxxx
>   struct S {};
> 
>   template <typename T>
>     requires xxxx
>   void foo() {}
> 
> Note that 'xxxx' has not been declared or defined.  Both MSVC and Clang
> complain about the undeclared identifier.  GCC does error if we attempt to
> instantiate either of these specialisations, but they always (silently) lose
> to a better match:
> 
>   template <typename T> struct S {};
>   template <typename T> requires xxxx struct S<T> {};
> 
>   template <typename T> void foo() {}
>   template <typename T> requires xxxx void foo() {}
> 
>   int main() {
>     S<int> x;
>     foo<int>();
>   }

Reply via email to