http://bugs.winehq.org/show_bug.cgi?id=58465
Bug ID: 58465 Summary: Wide string misbehavior on C++20 mode vs C++17 mode Product: Wine Version: 10.11 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winelib Assignee: wine-bugs@winehq.org Reporter: messmer.dalton@gmail.com Distribution: ---
Created attachment 78920 --> http://bugs.winehq.org/attachment.cgi?id=78920 Simple Winelib program to demonstate the bug (wine_test.cpp) + build/run script (wine_test.sh) + my test results (output.txt)
When I compile a Winelib application using the `--std=c++20` wineg++ flag instead of `--std=c++17`, I experience unexpected differences in behavior when using `std::wstring`. And in both C++ modes the behavior is incorrect.
For example, when I call the `c_str()` method on `std::wstring` and pass the returned wide C-string to `std::wcslen`, I get different results depending on whether the Winelib application was compiled in C++20 mode vs C++17 mode. And in both cases, the reported string length is incorrect.
Also, the distance between the `begin()` and `end()` iterators is different between C++ modes, and so is the return value of the `length()` method. And all of the results are incorrect in general.
I originally noticed these `std::wstring` problems here: https://github.com/LMMS/lmms/pull/7624#issuecomment-2923573719
I've attached a simple Winelib program that demonstrates the bug to this bug report.