https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122197
Barnabás Pőcze <pobrn at protonmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pobrn at protonmail dot com
--- Comment #16 from Barnabás Pőcze <pobrn at protonmail dot com> ---
Unfortunately it seems the std::shared_ptr workarounds in
r16-7106-g74e0bb3faacfccfdf5633ab7ad3a15549d4a954d do not always work. (Or am I
wrong in assuming that they were intended to cover most cases?) For example:
```
#include <memory>
#include <condition_variable>
extern std::shared_ptr<int> output_;
void f();
void f()
{
std::shared_ptr<int> output =
std::make_shared<int>();
output_ = output;
}
```
the above generates (`-Wall -Wextra -Werror -std=c++20 -O2`):
```
error: array subscript 'std::mutex[0]' is partly outside array bounds of
'unsigned char [24]' [-Werror=array-bounds=]
```
( https://gcc.godbolt.org/z/ErzPxeMKr )
However, curiously, if the `<conditional_variable>` include is removed, then it
compiles without a warning