r/cpp • u/holyblackcat • Mar 09 '26
The compilation procedure for C++20 modules
https://holyblackcat.github.io/blog/2026/03/09/compiling-modules.html
103
Upvotes
r/cpp • u/holyblackcat • Mar 09 '26
View all comments
Show parent comment
1
u/38thTimesACharm Mar 10 '26
I was under the impression the one-to-one correspondence between module interface partitions and module implementation partitions that implement them, which is frequently referenced in MS docs, is in fact non-standard behavior due to Microsoft devs misunderstanding the spec.
In fact, the standard seems to prohibit what Microsoft encourages. As it says two module partition units cannot have the same partition name:
So if I do
export module mod:partition.implin one file andmodule mod:partition.implin another, that would not be allowed according to spec.Right, I understand. You don't plan to
importthe partition anywhere, it's only separate to reduce build dependencies. But I don't see where the standard prohibits this.I'm certain you know more about this than me, so could you at least clarify: do you think the MSVC failing to compile your example is a bug in their compiler or a problem with the standard?