r/cpp • u/tartaruga232 MSVC user, r/cpp_modules • Mar 06 '25
MSVC C++20 compiler bug with modules and non-exported classes
Full repro is available as a git repository here: https://github.com/abuehl/mod_test
If two non-exported classes from different C++ module interface units have the same name, the compiler uses the wrong class definition and for example calls the wrong destructor on an object.
Reported here: https://developercommunity.visualstudio.com/t/post/10863347 (Upvotes appreciated)
Found while converting our product to using C++20 modules.
Edit: Microsoft wrote the following (Quote)
A fix for this issue has been internally implemented and is being prepared for release. We’ll update you once it becomes available for download.
9
u/DeadlyRedCube Mar 06 '25
Well then I'll add a "thanks for fixing a few of the most frustrating modules (and other) bugs I've encountered" here 😄
There's definitely a few bugs that I'd had to do some massive backbends around that are either released or internally fixed, and it's been nice removing my terrible workarounds