https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94869
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> --- OK thanks for confirming that. N.B. this is why you're supposed to provide preprocessed source. The code you showed to demonstrate the bug did *not* demonstrate it, because you were actually using something different (a modified version of <date.h>, or some extra code not shown in your example). Opening namespace std to add your own declarations to it (such as using-declarations of ::date::local_time) is forbidden, resulting in undefined behaviour. The result you got here is a good example of why. Instead of trying to add things to namespace std, you should do something like: #include <chrono> #if __cpp_lib_chrono >= 201803L namespace time = std::chrono; #else #include <date/date.h> namespace time = date; #endif // use time::duration, time::local_time etc.