Fix C++20 incompatibilities preventing compilation on MSVC (VS2017)#13
Closed
SirFerMoX wants to merge 1 commit intoLegionEmulationProject:legionfrom
Closed
Fix C++20 incompatibilities preventing compilation on MSVC (VS2017)#13SirFerMoX wants to merge 1 commit intoLegionEmulationProject:legionfrom
SirFerMoX wants to merge 1 commit intoLegionEmulationProject:legionfrom
Conversation
The project currently fails to compile on Windows using Visual Studio 2017 (MSVC v141) due to multiple C++20 features being used in a codebase configured for C++17. Below is a detailed list of all the changes required to make the project compile successfully on Windows.
|
This project is aiming to be updated for building on vs2022 and not vs2017. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
The project currently fails to compile on Windows using Visual Studio 2017 (MSVC v141) due to multiple C++20 features being used in a codebase configured for C++17. Below is a detailed list of all the changes required to make the project compile successfully on Windows.
The assignment to LPTSTR from a string literal fails because the project uses Unicode character set.
The function GetExceptionString is declared and defined as returning LPTSTR but actually returns const char* literals, causing C2440 errors.
Additionally, calls to DumpTypeIndex passing "" as the 7th argument need a cast:
std::type_identity is a C++20 feature not available in C++17. A custom implementation needs to be added.
std::type_identity_t is C++20. Replace with the custom Trinity::type_identity.
Template lambdas ([&](...)) are C++20. Replace with a struct Visitor, and the lambda passed as std::function<bool()>& must be stored in a named variable first.
std::chrono::year_month_day, hh_mm_ss, and sys_days are C++20. Replace with C++17 compatible code using gmtime.
Same C++20 date functions (year, month, day, sys_days). Replace with std::tm and mktime.
Designated initializers ({ .field = value }) are C++20. Replace with direct member assignment. Also, executor_work_guard has a deleted copy assignment operator, so it must be moved using aggregate initialization.
std::to_address is C++20. The field BuildingInfo.PacketInfo is a std::optional, so use has_value() and operator* instead.
Same std::to_address issue with std::optional.
Same std::to_address issue with OptionalMovement::SpellEffectExtraData.
std::random_shuffle was removed in C++17. Replace with std::shuffle and add #include .
Same std::random_shuffle removal. Add #include .
Environment: