Bug 115063 - compilation error: std::basic_stracktrace::max_size()
Summary: compilation error: std::basic_stracktrace::max_size()
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 14.1.1
: P3 normal
Target Milestone: 13.3
Assignee: Jonathan Wakely
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2024-05-13 06:57 UTC by Akira Takahashi
Modified: 2024-05-14 09:59 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2024-05-13 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Akira Takahashi 2024-05-13 06:57:29 UTC
#include <iostream>
#include <stacktrace>

int main() {
  std::stacktrace trace{};
  std::cout << trace.max_size() << std::endl;
}

outputs:

In file included from <source>:2:
/opt/compiler-explorer/gcc-14.1.0/include/c++/14.1.0/stacktrace: In instantiation of 'std::basic_stacktrace<_Allocator>::size_type std::basic_stacktrace<_Allocator>::max_size() const [with _Allocator = std::allocator<std::stacktrace_entry>; size_type = short unsigned int]':
<source>:6:30:   required from here
    6 |   std::cout << trace.max_size() << std::endl;
      |                ~~~~~~~~~~~~~~^~
/opt/compiler-explorer/gcc-14.1.0/include/c++/14.1.0/stacktrace:433:43: error: 'const struct std::basic_stacktrace<std::allocator<std::stacktrace_entry> >::_Impl' has no member named '_M_alloc'; did you mean '_M_allocate'?
  433 |       { return _Impl::_S_max_size(_M_impl._M_alloc); }
      |                                   ~~~~~~~~^~~~~~~~
      |                                   _M_allocate
Compiler returned: 1
Comment 1 GCC Commits 2024-05-14 09:50:58 UTC
The releases/gcc-14 branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

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

commit r14-10207-gc60205cd4aeea586b7b1fe06baa9861b6d279648
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon May 13 16:25:13 2024 +0100

    libstdc++: Fix typo in std::stacktrace::max_size [PR115063]
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/115063
            * include/std/stacktrace (basic_stacktrace::max_size): Fix typo
            in reference to _M_alloc member.
            * testsuite/19_diagnostics/stacktrace/stacktrace.cc: Check
            max_size() compiles.
    
    (cherry picked from commit dd9677f3343ca2a4b4aab9428b8129774accac29)
Comment 2 GCC Commits 2024-05-14 09:52:19 UTC
The releases/gcc-13 branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:7dca716decf5a07f903610fda9457ff0422d2758

commit r13-8772-g7dca716decf5a07f903610fda9457ff0422d2758
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon May 13 16:25:13 2024 +0100

    libstdc++: Fix typo in std::stacktrace::max_size [PR115063]
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/115063
            * include/std/stacktrace (basic_stacktrace::max_size): Fix typo
            in reference to _M_alloc member.
            * testsuite/19_diagnostics/stacktrace/stacktrace.cc: Check
            max_size() compiles.
    
    (cherry picked from commit dd9677f3343ca2a4b4aab9428b8129774accac29)
Comment 3 GCC Commits 2024-05-14 09:57:55 UTC
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

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

commit r15-481-gccc26a1af07b34ce2e7d3b2497f27992d1b1bbc2
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon May 13 16:25:13 2024 +0100

    libstdc++: Fix typo in std::stacktrace::max_size [PR115063]
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/115063
            * include/std/stacktrace (basic_stacktrace::max_size): Fix typo
            in reference to _M_alloc member.
            * testsuite/19_diagnostics/stacktrace/stacktrace.cc: Check
            max_size() compiles.
Comment 4 Jonathan Wakely 2024-05-14 09:59:31 UTC
Fixed for 13.3 and 14.2, thanks for the report.