https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125359
Zhongteng Gui <dragon-archer at outlook dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dragon-archer at outlook dot
com
--- Comment #8 from Zhongteng Gui <dragon-archer at outlook dot com> ---
This issue is reported again at
https://github.com/msys2/MINGW-packages/issues/31015, and I did a few
investigation.
The problem only happens on a very specific situation:
1. `-std=c++20`, all other standards (C++11, 14, 17, 23, 26) doesn't have this
issue. Sadly C++20 is the default now.
2. `-fdeclone-ctor-dtor`, which is implied in `-Os` and `-Oz`. If you manually
disable this and compiles with `-Os -fno-declone-ctor-dtor` then it doesn't
cause the issue.
I suspect this comes from:
```
# if __cplusplus <= 202002L && _GLIBCXX_EXTERN_TEMPLATE > 0
extern template class basic_string<char>;
```
at bits/basic_string.tcc#L1041, if I change `__cplusplus <= 202002L` to
`__cplusplus <= 201703L` then the problem also disappear (for all standards).
However I'm not sure whether that will cause other issues.