public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103849] New: std::hash specializations with distinct concepts fails
@ 2021-12-28  7:03 fchelnokov at gmail dot com
  2021-12-28  9:29 ` [Bug c++/103849] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: fchelnokov at gmail dot com @ 2021-12-28  7:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103849
           Summary: std::hash specializations with distinct concepts fails
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

The two specialization of std::hash with distinct concepts:
```
#include <concepts>
#include <functional>

template <std::convertible_to<int> T>
struct std::hash<T> {};

template <std::convertible_to<float> U>
struct std::hash<U> {};

int main() {}
```
fails to compile in GCC with the error:
```
error: redefinition of 'struct std::hash<_Tp>'
    8 | struct std::hash<U> {};
```
Clang and MSVC have no problem with it. Demo:
https://gcc.godbolt.org/z/z4f3o6bdo

Related discussion: https://stackoverflow.com/q/68885697/7325599

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

* [Bug c++/103849] std::hash specializations with distinct concepts fails
  2021-12-28  7:03 [Bug c++/103849] New: std::hash specializations with distinct concepts fails fchelnokov at gmail dot com
@ 2021-12-28  9:29 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-28  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 92944.

*** This bug has been marked as a duplicate of bug 92944 ***

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

end of thread, other threads:[~2021-12-28  9:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28  7:03 [Bug c++/103849] New: std::hash specializations with distinct concepts fails fchelnokov at gmail dot com
2021-12-28  9:29 ` [Bug c++/103849] " 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).