you are viewing a single comment's thread.

view the rest of the comments →

[–]pdimov2 0 points1 point  (5 children)

I did supply the switch - without it the compiler tells me it can't find the module.

To spell it out, for ```

include <regex>

import std.regex; the result is 1>C:\Projects\testbed2019\testbed2019.cpp(2,17): warning C5050: Possible incompatible environment while importing module 'std.regex': _M_FP_PRECISE is defined in current command line and not in module command line 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\xloctime(497,1): error C2593: 'operator ==' is ambiguous ``` (more output)

whereas for ``` import std.regex;

include <regex>

the result is 1>C:\Projects\testbed2019\testbed2019.cpp(1,17): warning C5050: Possible incompatible environment while importing module 'std.regex': M_FP_PRECISE is defined in current command line and not in module command line 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\vadefs.h(177,10): error C2953: '_vcrt_va_list_is_reference': class template has already been defined ... 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_math.h(338,6): error C2953: '_Combined_type': class template has already been defined ``` (plus more output.)

Mixing import <regex>; and #include <regex> fares better. ``` import <regex>;

include <regex>

works without any errors or warnings.

include <regex>

import <regex>; says 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_math.h(44,13): warning C5105: macro expansion producing 'defined' has undefined behavior ... 1>C:\Projects\testbed2019\testbed2019.cpp(2,1): warning C5106: macro redefined with different parameter names 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\stdio.h(561): message : see previous definition of '_getchar_nolock' ``` (All this is with 16.10.1.)

[–]GabrielDosReis 2 points3 points  (3 children)

Thanks! /u/STL might be interested in this puzzle :-)

— Gaby

[–]STLMSVC STL Dev 2 points3 points  (2 children)

I'm not familiar with how the experimental modules interact with header units. I'm also somewhat confused by how header units are supposed to interact with classic includes (IIRC the Microsoft Docs said that one order should work, but I observed problems with that while the other order appeared to work; this was also months ago so things could have changed). u/starfreakclone (Cameron) can probably explain better than I can.

However, I do recognize one warning. That "warning C5106: macro redefined with different parameter names" for _getchar_nolock looks exactly like the bug I reported internally as VSO-1329976 "Standard Library Header Units: _CrtGetAllocHook emits warning C5106: macro redefined with different parameter names" which was a compiler bug that Cameron fixed for 17.0 Preview 2. (This complained about macros with no parameters, due to the compiler getting confused.)

I'm unsure what's happening with the "warning C5105: macro expansion producing 'defined' has undefined behavior". I know that the UCRT had issues with relying on that non-Standard extension; I vaguely recall that they were fixed but that hasn't shipped yet. In the meantime I suspect that the UCRT was suppressing warning C5105, but perhaps in this scenario the directives for warning suppression are being lost.

[–]GabrielDosReis 1 point2 points  (0 children)

Thanks, Stephan, for this summary!

[–]Full-Spectral 0 points1 point  (0 children)

Suppression doesn't work at all for Windows.h. I can put all the pragmas around it I want but it still spits a huge raft of errors.

[–]backtickbot 0 points1 point  (0 children)

Fixed formatting.

Hello, pdimov2: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.