[Bug c++/96840] New: Recursive substitution in constrained commutative operator

johelegp at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Aug 29 00:29:34 GMT 2020


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

            Bug ID: 96840
           Summary: Recursive substitution in constrained commutative
                    operator
           Product: gcc
           Version: 11.0
               URL: https://godbolt.org/z/cedacs
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
  Target Milestone: ---

I may be wrong, but I think this should compile. Clang accepts it as does GCC
10.2 and did the GCC 11 build from a little while ago.
See the URL:
```C++
template <class T, class U> concept C = requires(T t, U u) { t * u; };
template <class Rep> struct Int {
     template <class T> requires C<T, Rep> friend void operator*(T, Int) { }
     template <class T> requires C<T, Rep> friend void operator*(Int, T) { }
};
void f() { 0 * Int<int>{}; }
```


More information about the Gcc-bugs mailing list