public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/112348] New: [C++23] defect in struct hash<basic_stacktrace<_Allocator>>
@ 2023-11-02 10:15 vincenzo.innocente at cern dot ch
  2023-11-09 16:59 ` [Bug libstdc++/112348] " vincenzo.innocente at cern dot ch
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2023-11-02 10:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112348
           Summary: [C++23] defect in struct
                    hash<basic_stacktrace<_Allocator>>
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincenzo.innocente at cern dot ch
  Target Milestone: ---

gcc version 14.0.0 20231028 (experimental) [master r14-4988-g5d2a360f0a5] (GCC)

 auto k = std::hash<std::stacktrace>()(std::stacktrace::current());

does not compile to me with error

In instantiation of 'std::size_t std::hash<std::basic_stacktrace<_Allocator>
>::operator()(const std::basic_stacktrace<_Allocator>&) const [with _Allocator
= std::allocator<std::stacktrace_entry>; std::size_t = long unsigned int]':
testStacktrace.cpp:39:41:   required from here
   39 |    auto k = std::hash<std::stacktrace>()(std::stacktrace::current());
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/afs/cern.ch/work/i/innocent/public/w5/include/c++/14.0.0/stacktrace:803:49:
error: no match for call to '(std::hash<long unsigned int>) (const
std::stacktrace_entry&)'
  803 |           __val = _Hash_impl::__hash_combine(__h(__f), __val);
      |                                              ~~~^~~~~


changed
        // hash<stacktrace_entry::native_handle_type> __h;
        hash<stacktrace_entry> __h;

and it compiled.
(I suspect __f.native_handle() would work as well)

Surprised it passed tests.

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

* [Bug libstdc++/112348] [C++23] defect in struct hash<basic_stacktrace<_Allocator>>
  2023-11-02 10:15 [Bug libstdc++/112348] New: [C++23] defect in struct hash<basic_stacktrace<_Allocator>> vincenzo.innocente at cern dot ch
@ 2023-11-09 16:59 ` vincenzo.innocente at cern dot ch
  2023-11-09 21:14 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2023-11-09 16:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
This patch works for me

diff --git a/libstdc++-v3/include/std/stacktrace
b/libstdc++-v3/include/std/stacktrace
index da0e48d3532..9a0d0b16068 100644
--- a/libstdc++-v3/include/std/stacktrace
+++ b/libstdc++-v3/include/std/stacktrace
@@ -797,7 +797,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       size_t
       operator()(const basic_stacktrace<_Allocator>& __st) const noexcept
       {
-       hash<stacktrace_entry::native_handle_type> __h;
+       hash<stacktrace_entry> __h;
        size_t __val = _Hash_impl::hash(__st.size());
        for (const auto& __f : __st)
          __val = _Hash_impl::__hash_combine(__h(__f), __val);

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

* [Bug libstdc++/112348] [C++23] defect in struct hash<basic_stacktrace<_Allocator>>
  2023-11-02 10:15 [Bug libstdc++/112348] New: [C++23] defect in struct hash<basic_stacktrace<_Allocator>> vincenzo.innocente at cern dot ch
  2023-11-09 16:59 ` [Bug libstdc++/112348] " vincenzo.innocente at cern dot ch
@ 2023-11-09 21:14 ` redi at gcc dot gnu.org
  2023-11-14 21:58 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-09 21:14 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-11-09
     Ever confirmed|0                           |1

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

* [Bug libstdc++/112348] [C++23] defect in struct hash<basic_stacktrace<_Allocator>>
  2023-11-02 10:15 [Bug libstdc++/112348] New: [C++23] defect in struct hash<basic_stacktrace<_Allocator>> vincenzo.innocente at cern dot ch
  2023-11-09 16:59 ` [Bug libstdc++/112348] " vincenzo.innocente at cern dot ch
  2023-11-09 21:14 ` redi at gcc dot gnu.org
@ 2023-11-14 21:58 ` redi at gcc dot gnu.org
  2023-11-14 22:32 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-14 21:58 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.4
             Status|NEW                         |ASSIGNED

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to vincenzo Innocente from comment #0)
> Surprised it passed tests.

Tests can't fail if you don't write them

guy-tapping-head.gif

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

* [Bug libstdc++/112348] [C++23] defect in struct hash<basic_stacktrace<_Allocator>>
  2023-11-02 10:15 [Bug libstdc++/112348] New: [C++23] defect in struct hash<basic_stacktrace<_Allocator>> vincenzo.innocente at cern dot ch
                   ` (2 preceding siblings ...)
  2023-11-14 21:58 ` redi at gcc dot gnu.org
@ 2023-11-14 22:32 ` cvs-commit at gcc dot gnu.org
  2023-11-14 22:40 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-14 22:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:6f2fc42d9e52e8322e718e0154cd235d00906f99

commit r14-5465-g6f2fc42d9e52e8322e718e0154cd235d00906f99
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Nov 14 22:02:55 2023 +0000

    libstdc++: Fix std::hash<std::stacktrace> [PR112348]

    libstdc++-v3/ChangeLog:

            PR libstdc++/112348
            * include/std/stacktrace (hash<basic_stacktrace<Alloc>>): Fix
            type of hash functio nfor entries.
            * testsuite/19_diagnostics/stacktrace/hash.cc: New test.

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

* [Bug libstdc++/112348] [C++23] defect in struct hash<basic_stacktrace<_Allocator>>
  2023-11-02 10:15 [Bug libstdc++/112348] New: [C++23] defect in struct hash<basic_stacktrace<_Allocator>> vincenzo.innocente at cern dot ch
                   ` (3 preceding siblings ...)
  2023-11-14 22:32 ` cvs-commit at gcc dot gnu.org
@ 2023-11-14 22:40 ` cvs-commit at gcc dot gnu.org
  2023-11-14 22:43 ` cvs-commit at gcc dot gnu.org
  2023-11-14 22:44 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-14 22:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:16635b89f36c07b9e06c48a93d1bfafa93178328

commit r13-8067-g16635b89f36c07b9e06c48a93d1bfafa93178328
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Nov 14 22:36:31 2023 +0000

    libstdc++: Fix std::hash<std::stacktrace> [PR112348]

    libstdc++-v3/ChangeLog:

            PR libstdc++/112348
            * include/std/stacktrace (hash<basic_stacktrace<Alloc>>): Fix
            type of hash function for entries.
            * testsuite/19_diagnostics/stacktrace/hash.cc: New test.

    (cherry picked from commit 6f2fc42d9e52e8322e718e0154cd235d00906f99)

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

* [Bug libstdc++/112348] [C++23] defect in struct hash<basic_stacktrace<_Allocator>>
  2023-11-02 10:15 [Bug libstdc++/112348] New: [C++23] defect in struct hash<basic_stacktrace<_Allocator>> vincenzo.innocente at cern dot ch
                   ` (4 preceding siblings ...)
  2023-11-14 22:40 ` cvs-commit at gcc dot gnu.org
@ 2023-11-14 22:43 ` cvs-commit at gcc dot gnu.org
  2023-11-14 22:44 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-14 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:a97c08ea530dadf366022b5c3e5aab21d34a61bd

commit r12-9978-ga97c08ea530dadf366022b5c3e5aab21d34a61bd
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Nov 14 22:36:31 2023 +0000

    libstdc++: Fix std::hash<std::stacktrace> [PR112348]

    libstdc++-v3/ChangeLog:

            PR libstdc++/112348
            * include/std/stacktrace (hash<basic_stacktrace<Alloc>>): Fix
            type of hash function for entries.
            * testsuite/19_diagnostics/stacktrace/hash.cc: New test.

    (cherry picked from commit 6f2fc42d9e52e8322e718e0154cd235d00906f99)

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

* [Bug libstdc++/112348] [C++23] defect in struct hash<basic_stacktrace<_Allocator>>
  2023-11-02 10:15 [Bug libstdc++/112348] New: [C++23] defect in struct hash<basic_stacktrace<_Allocator>> vincenzo.innocente at cern dot ch
                   ` (5 preceding siblings ...)
  2023-11-14 22:43 ` cvs-commit at gcc dot gnu.org
@ 2023-11-14 22:44 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-14 22:44 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for all branches, thanks for the report.

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

end of thread, other threads:[~2023-11-14 22:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-02 10:15 [Bug libstdc++/112348] New: [C++23] defect in struct hash<basic_stacktrace<_Allocator>> vincenzo.innocente at cern dot ch
2023-11-09 16:59 ` [Bug libstdc++/112348] " vincenzo.innocente at cern dot ch
2023-11-09 21:14 ` redi at gcc dot gnu.org
2023-11-14 21:58 ` redi at gcc dot gnu.org
2023-11-14 22:32 ` cvs-commit at gcc dot gnu.org
2023-11-14 22:40 ` cvs-commit at gcc dot gnu.org
2023-11-14 22:43 ` cvs-commit at gcc dot gnu.org
2023-11-14 22:44 ` redi 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).