Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@StephanTLavavej
Copy link
Contributor

I work on Microsoft Visual C++, where we regularly build popular open-source projects, including yours, with development builds of our compiler and libraries to detect and prevent shipping regressions that would affect you. This also allows us to provide advance notice of breaking changes, which is the case here.

I just merged microsoft/STL#5105, which revealed a conformance issue in TrinityCore.

The primary compiler error with this STL change is:

C:\gitP\TrinityCore\TrinityCore\src\common\Utilities\Duration.h(42,22): error C3083: 'system_clock': the symbol to the left of a '::' must be a type

With many cascading errors - deduplicated to one per file, they are:

C:\gitP\TrinityCore\TrinityCore\src\common\Metric\Metric.cpp(131,21): error C2582: 'operator =' function is unavailable in 'std::chrono::time_point'
C:\gitP\TrinityCore\TrinityCore\src\common\Metric\Metric.h(53,21): error C2955: 'std::chrono::time_point': use of class template requires template argument list
C:\gitP\TrinityCore\TrinityCore\src\common\Time\Timer.h(133,31): error C3688: invalid literal suffix 's'; literal operator or literal operator template 'operator ""s' not found
C:\gitP\TrinityCore\TrinityCore\src\common\Time\Timezone.cpp(108,8): error C3688: invalid literal suffix 'min'; literal operator or literal operator template 'operator ""min' not found
C:\gitP\TrinityCore\TrinityCore\src\common\Time\Timezone.h(30,61): error C2955: 'std::chrono::time_point': use of class template requires template argument list
C:\gitP\TrinityCore\TrinityCore\src\common\Utilities\EventProcessor.cpp(78,39): error C3688: invalid literal suffix 'ms'; literal operator or literal operator template 'operator ""ms' not found

The problem is that 585900f introduced a non-portable hack, reaching into MSVC STL implementation details (undocumented and unsupported). After microsoft/STL#5105, this internal header no longer provides system_clock or the chrono_literals, so you must include the full <chrono>.

(We added <__msvc_chrono.hpp> to improve the compiler throughput / build speed of <thread> etc., and we're moving system_clock etc. out of it in order to further improve compiler throughput. This MSVC STL internal header was never intended for users to include directly, and is not a general mechanism to "include the pre-C++20 parts of <chrono>". I recognize that it's ironic that our change to improve compiler throughput elsewhere will decrease your throughput as you have to include the full header.)

As an aside, if you want to significantly improve compiler throughput, I recommend setting up precompiled headers; it takes a bit of work but it significantly improves build throughput. (C++20 header units are an alternative, but may be less easy to adopt.)

@Shauren Shauren merged commit 96956b0 into TrinityCore:master Nov 23, 2024
8 checks passed
@StephanTLavavej StephanTLavavej deleted the include-chrono branch November 23, 2024 01:50
Ovahlord pushed a commit that referenced this pull request Nov 24, 2024
…` - will break in future MSVC release (#30460)

(cherry picked from commit 96956b0)
aquadeus pushed a commit to aquadeus/TrinityCore that referenced this pull request Nov 29, 2024
Shauren pushed a commit that referenced this pull request Feb 15, 2025
…` - will break in future MSVC release (#30460)

(cherry picked from commit 96956b0)
Declipe pushed a commit to Declipe/TrinityCore that referenced this pull request Feb 19, 2025
…` - will break in future MSVC release (TrinityCore#30460)

(cherry picked from commit 96956b0)
TesterWoWDev pushed a commit to tswow/TrinityCore that referenced this pull request Mar 15, 2025
TesterWoWDev pushed a commit to Duskhaven-Reforged/dusk-ts-tc that referenced this pull request Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants