Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include <string> before using std::basic_string #58

Merged
merged 1 commit into from
Jun 6, 2024
Merged

Include <string> before using std::basic_string #58

merged 1 commit into from
Jun 6, 2024

Conversation

StephanTLavavej
Copy link
Contributor

I work on MSVC's STL, and we regularly build popular open-source projects, including yours, with development builds of the MSVC toolset. This allows us to find and fix toolset regressions before they affect users, and also allows us to provide advance notice of breaking changes, which is the case here.

We recently merged microsoft/STL#4633 which will ship in VS 2022 17.11 Preview 3. This improved build throughput by refactoring <string_view> so that it no longer drags in std::basic_string. It's also a source-breaking change for code that wasn't properly including <string>.

Your include/nonstd/string_view.hpp has an "early" use of std::basic_string that isn't preceded by #include <string>. When built with our updated STL, this will emit a compiler error C2039: 'basic_string': is not a member of 'std'. The fix is simple and portable: simply include the necessary header, immediately before it's needed.

I checked the rest of your header, and all following mentions of std::basic_string further down in the file appear to be correctly preceded by #include <string>.

@martinmoene martinmoene merged commit 5f32805 into martinmoene:master Jun 6, 2024
7 checks passed
@StephanTLavavej StephanTLavavej deleted the include-string branch June 6, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants