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

            Bug ID: 107605
           Summary: GCC rejects valid program involving std::bind and
                    requires
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jlame646 at gmail dot com
  Target Milestone: ---

The following valid program(afaik) is rejected by gcc but accepted by clang.
Demo: https://godbolt.org/z/bdMfKE41n

```
template <typename T>                                                           
class myclass {                                                                 
public:                                                                         

  void func(const T&) requires true
  {
     std::cout << "true";
  }

  void func(const T&) requires false
  {
     std::cout << "false";
  }
};                                                                              


int main(){                                                                     

  myclass<int> obj;                                                             
  auto mylambda = std::bind(&myclass<int>::func, &obj, 5); //accepted by clang
rejected by gcc
  mylambda();                                                                   

} 
```
The error says:

```
error: no matching function for call to 'bind(<unresolved overloaded function
type>, myclass<int>*, int)'
   24 |   auto mylambda = std::bind(&myclass<int>::func, &obj, 5); //accepted
by clang rejected by gcc
```

This has been discussed here:
https://stackoverflow.com/questions/74385849/clang-accepts-program-involving-requires-constraint-while-gcc-and-msvc-rejects-i

Reply via email to