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

[MSVC][std:c++20] flatbuffers failed to detect c++ standard on MSVC #8154

Closed
assorted opened this issue Nov 11, 2023 · 2 comments
Closed

[MSVC][std:c++20] flatbuffers failed to detect c++ standard on MSVC #8154

assorted opened this issue Nov 11, 2023 · 2 comments

Comments

@assorted
Copy link
Contributor

The following code is utilized by FlatBuffers for detecting the language standard:

#ifndef FLATBUFFERS_USE_STD_SPAN
  // Testing __cpp_lib_span requires including either <version> or <span>,
  // both of which were added in C++20.
  // See: https://en.cppreference.com/w/cpp/utility/feature_test
  #if defined(__cplusplus) && __cplusplus >= 202002L
    #define FLATBUFFERS_USE_STD_SPAN 1
  #endif
#endif // FLATBUFFERS_USE_STD_SPAN

This results in a build error when utilizing flatbuffers::span, both with MSBuild and CMake.
Microsoft uses a fake value __cplusplus == 199711L for compatibility, and they advise using _MSVC_LANG instead

@assorted
Copy link
Contributor Author

MR: #8155

@assorted
Copy link
Contributor Author

Merged

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

No branches or pull requests

1 participant