public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107605] New: GCC rejects valid program involving std::bind and requires
@ 2022-11-10  8:06 jlame646 at gmail dot com
  2022-11-10 12:05 ` [Bug c++/107605] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jlame646 at gmail dot com @ 2022-11-10  8:06 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-10 23:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10  8:06 [Bug c++/107605] New: GCC rejects valid program involving std::bind and requires jlame646 at gmail dot com
2022-11-10 12:05 ` [Bug c++/107605] " redi at gcc dot gnu.org
2022-11-10 12:50 ` [Bug c++/107605] GCC rejects valid program involving requires-clause jlame646 at gmail dot com
2022-11-10 13:49 ` redi at gcc dot gnu.org
2022-11-10 23:15 ` [Bug c++/107605] constraint on a member function does causes ambigious and not allowing forming a pointer to the function pinskia at gcc dot gnu.org
2022-11-10 23:20 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).