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

            Bug ID: 120931
           Summary: At GCC 15.1.0 build fails with -std=c++98 on attempt
                    to use std::deque<uint8_t>::resize() method
           Product: gcc
           Version: 15.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nvd339 at yandex dot ru
  Target Milestone: ---

Hello!

When trying to compile this small code piece with -std=c++98, it just fails on
std::deque's resize() method when everything just worked everywhere also, on
older GCC versions and at all other compilers as well.

This short example will fail if try to build it with `-std=c++98` argument.
---------------------
#include <stdint.h>
#include <stddef.h>
#include <deque>

static std::deque<uint8_t> g_deque;

int main()
{
     size_t got = 42;

     g_deque.resize(666);

     size_t pos = g_deque.size();
     g_deque.resize(pos + got);

     return 0;
}

---------------------

Here are two reports at my projects that was been affected by this bug:
- https://github.com/Wohlstand/libADLMIDI/issues/291
- https://github.com/Wohlstand/libOPNMIDI/issues/124

I compiled GCC 15.1.0 from the source to verify the thing on my end and make
the workaround for it.

P.S. I declare the use of C++98 at two library projects to ensure that code can
be build on old compilers too.

Reply via email to