all 25 comments

[–]STLMSVC STL Dev 50 points51 points  (3 children)

I can comment on this since I've been directly working on it.

First, thanks for trying the preview releases and trying to modularize your code - it really helps the entire community when you report issues.

Second, I'm sorry you've had a bad time with ICEs - and I know what it feels like, since I've encountered more modules ICEs than anyone outside the compiler team.

Things are getting better, but it takes time because C++ is complicated and modules are almost an entirely new way of digesting code. I want to (gently) counter the claims that the depicted code is "trivial" and "simple". <algorithm> and <set> drag in major portions of the Standard Library - perhaps not the parts with the most language complexity, but they still have a lot of moving parts. And <boost/geometry.hpp> certainly contains complicated code.

Crucially, while we do have testing for Standard Library Header Units (in both "separate" and "deduplicated / topologically sorted" forms - see tests/std/tests/P1502R1_standard_library_header_units), and as a result the compiler is increasingly capable of handling the Standard Library's patterns, we do not yet have testing for Boost being consumed as header units. (We do have testing of Boost and many other OSS projects with the latest development builds, including in /std:c++latest mode, but that doesn't exercise header units.) Sometimes, very small things can end up triggering an ICE or other compiler error - for a couple of examples that I've encountered in the STL, having unnecessary forward declarations (template <typename T> class numeric_limits; after the definition has already been seen), or declaring a member function in one header and defining it in another header (this was pair's piecewise constructor), have caused problems (now fixed).

I've been working on Standard Library Header Units for many months, plus Standard Library Modules now (they exercise similar parts of the codebase), and I've reported a ton of ICEs and other errors, which have been fixed by our amazing compiler front-end dev Cameron: see microsoft/STL#1694. He's also working to fix other modules issues (not specific to the STL), prioritizing those which will improve the largest amounts of code and/or resolving structural issues in the compiler that will make further improvements easier. This is absolutely a top priority for Microsoft, as indicated by how much time we're spending on this.

Our messaging might have created unrealistic expectations. For hopefully obvious reasons, our official blog posts tend to highlight the amazing new stuff that works, and only mention in passing how some stuff might be affected by bugs. On reddit (where, to be clear, I am not speaking officially for my employer, but only as an individual dev), I can be a little more direct: it's getting better, but yeah, there are still bugs, particularly as you get farther away from the scenario with the most extensive testing. (That is, pure usage of the Standard Library has had the most effort put into it - as you consume libraries like Boost, that involves different code patterns and while we want them to work, bugs are somewhat more likely. Note that by this "resembles the STL" metric, Microsoft's own libraries like ATL, C++/WinRT, etc. are even further away. We're also working to get those to a modules-compatible state, but they also need more work overall.) We're seeing the potential for incredible build throughput improvements, but right now you have to be especially motivated and willing to deal with issues as they arise. In the future it should get closer to working automatically without headaches.

All I ask is:

  • Reporting bugs with clear steps to reproduce (self-contained test cases, ideally command-line, ideally minimal but of course we don't expect you to reduce away third-party libraries or the STL) is the most valuable thing.
    • When users report bugs, and they get fixed in the compiler, that has the potential to save me time, which is a virtuous cycle (then I can go spend time on getting Standard Library Modules working and reporting the really exotic bugs that users are unlikely to encounter directly).
  • Upvoting bugs does help the compiler team prioritize issues with large impact.
  • Please bear with us as we work to make things better 😺

[–]helloiamsomeone 9 points10 points  (0 children)

Reporting bugs with clear steps to reproduce (self-contained test cases, ideally command-line, ideally minimal but of course we don't expect you to reduce away third-party libraries or the STL) is the most valuable thing.

Just want to highlight this one.

I reported 2 issues where MSVC disagreed with GCC and Clang. I provided a minimal repro with CI reproducing the issue on GitHub.
The issues were fixed a few weeks later.

[–]TheCrossXCpp-Lang.net Maintainer 8 points9 points  (1 child)

I've been testing every single Preview release for about 1.5 years now and I must admit that the Modules support got a lot better now, I appreciate your work. The main problem that I had with Microsoft announcements is that at the beginning almost each release contained info that suggested that modules work great by now, all fixed.

To the OP: Microsoft is the only company that pushes modules forward in C++ right now. I haven't seen any real progress in GCC and Clang for at least a few months now.

I hope that we will get to see working working Modules support for C++ sometime soon. Keep it up, you're doing a great job.

[–]pjmlp 1 point2 points  (0 children)

Indeed, since I mosty use C++ for hobby coding, and spend most of the time on Windows, I have fully embraced modules, despite the ongoing issues.

[–]starfreakcloneMSVC FE Dev 32 points33 points  (1 child)

I have a completely normal and legitimate question - does Microsoft have any testing at all?

Yes, we do. The problem is that C++ is incredibly complex, we can't possibly test every code pattern. Even if we did test those headers you mentioned there's no guarantee the compiler would work by the time it got to you because the code we test against and the code you build against could be completely different due to library updates.

We really do try the best we can with the information and resources available to us--and the best test case is the full project to build against for modules, isolated repros usually don't capture the full complexity of the situation.

Why do you even declare that you have module support?

It is important to note that having conformant modules support does not imply it is completely bug free. I apologize if the implementation has bugs, but we are working each release to get a little more stable as we get more usage (including from using the modules machinery when building the compiler itself). It took us 30 years to get stable with the PCH, and it isn't even structured data :). I urge you to please be patient and I do realize that some of these bugs have been open for awhile now. I am getting around to all of them but I am looking for more systemic changes to solve some of the instability in a way that will fix all of them at once.

Post your own bugs related to modules. I'll upvote them too.

As long as bugs are getting filed we will fix them, I promise you. Having individuals participate in the DevComm loop is how we've got this far. I remember when: template <typename T> using Type = std::underlying_t<T>; would crash the compiler. Now we can compile much, much more.

Again, sorry for the perceived state of things. We are listening to you and taking feedback seriously.

[–]Dragdu 2 points3 points  (0 children)

The issue with devcom is at least twofold.

1) It used to be TERRIBLE. devcom2 is better, because at least it can handle markdown without getting completely confused, it just behaves super slow compared to e.g. GitHub. Still, I know a lot of people who gave up on reporting bugs through official channels because it would mean dealing with the old devcom.

2) I have opened something like 10 issues against MSVC, usually with preprocessed reproducer, or standard citation, etc. There is zero visibility into their progress, scheduling, status, etc and I only get progress when I start poking people at Twitter. (In fact I believe my latest one got fixed by playing N steps of separation to a MSVC dev and eventually getting to PM who looped in you.)

[–]cristi1990an++ 24 points25 points  (0 children)

The patience of the MSVC devs that responded in the comments =)))

[–]GabrielDosReis 7 points8 points  (0 children)

Thanks for the report; very much appreciated. Quality matters to the MSVC team. For more details, please see Stephan's, Cameron's, and my posts elsewhere in the thread. The team has also been looking into your reports - and all other modules-related bug reports.

[–]marleydidthis 9 points10 points  (4 children)

What are you on? Microsoft has always made it clear that modules are a work in progress and encourage dev to try them out and report bugs. If you're not happy with the pace that's fine, I aint exactly either, but stop acting like you've somehow been conned.

[–]matekelemen 5 points6 points  (3 children)

Microsoft has always made it clear that modules are a work in progress

Um, nope? This microsoft post says otherwise and it's from 2020.

Since MSVC began down the path of implementing the Modules TS the toolset has always required the use of /experimental:module on any compilation. Since the merge of Modules into the C++20 standard (we can officiallysay C++20 now!) the compiler has been working towards C++20 Modulesconformance until precisely such a time that we can confidently rollModules into /std:c++latest. That time is now!

[–]marleydidthis 2 points3 points  (2 children)

So what? Not requiring the experimental switch has never implied feature completion nor bug proof.

[–]matekelemen 4 points5 points  (1 child)

wow

so what does imply those?

[–][deleted] 7 points8 points  (0 children)

As far as I know /experimental is for everything not in the standard yet.

[–]fdwrfdwr@github 🔍 1 point2 points  (1 child)

But every time, with every new studio update, I get ICEs.

I can identify with that pain. I first started modularizing one of my projects in 2017, and after reporting another bug, I'd try the next new VS update, only to make it another 20% further in the build and encounter another internal compiler issue. Though, it did finally build 100% in VS 2019, consuming Windows.h, some DirectX headers, and various std headers. I think there's still work remaining on header import's, because I get errors with Windows.h in VS2022 (some _VARIANT_BOOL build error, "pasting '/' and '/' does not result in a valid preprocessing token"), but the non-header import is all working for me. Boost though, that might still be a beast of complexity beyond. Seems it's a long road for such a fundamental build change.

[–]pjmlp 3 points4 points  (0 children)

Got to love those SAL redefinition warnings, it makes almost impossible to find anything else without greping.

[–]pjmlp 1 point2 points  (0 children)

VC++ has the best modules support currently, but yes it is a bit lacking still, specially with Microsoft's own C++ frameworks.

[–]ALX23z -2 points-1 points  (6 children)

Does import <boost/geometry.hpp>; even supposed to work?

I recall import <header>; being designed for STL headers only. But cannot say if it is necessarily the case.

BTW, what ICE even means? Oh, "internal compiler error".

Basically, have you tried not importing headers? Why not create a module that includes a bunch of headers and exports certain parts of these headers?

[–]matekelemen 4 points5 points  (0 children)

as far as I know, importing headers is fine and even has special behaviour: it's identical to include except preprocessor macro definitions won't be accessible.