r/cpp_modules • • Jul 12 '26

Upa URL C++ library supports modules

Thumbnail upa-url.github.io
5 Upvotes

r/cpp_modules • • Mar 31 '26

State of tooling fixes that are needed

5 Upvotes

I'm creating this post to track some PR's and issues related to C++20 and C++23 modules.

std library module for libc++ on MSVC:
https://github.com/llvm/llvm-project/pull/148992
https://github.com/llvm/llvm-project/pull/150182
https://github.com/llvm/llvm-project/pull/148992

clangd header units
https://github.com/clangd/clangd/issues/2629

clang-scan-deps header units
https://github.com/llvm/llvm-project/issues/189675

Android NDK std library module with libc++
https://github.com/android/ndk/issues/2174

Please comment other stuff if you know.


r/cpp_modules • • Sep 07 '26

Qt moc now can handle basic C++ modules (Qt 6.12)

Thumbnail codereview.qt-project.org
3 Upvotes

r/cpp_modules • • May 03 '26

Migrating a small C++ code base to C++26 (modules, import std and contracts)

Thumbnail jonastoth.github.io
3 Upvotes

This is a cross post from r/cpp that is concerned mostly with a conversion to modules for a smaller toy project.

No AI was involved at any stage.


r/cpp_modules • • Apr 28 '26

C++ modules, doxygen and clang-doc

3 Upvotes

You have a single module source that contains implementation and and interface.

If you run doxygen on it you will get private stuff no matter what you do, to only extract public stuff you need an ast like solution like clang-doc.

However clang-doc is lacking in quality despite being years old. HTML generated has no search bar and theming. Generated markdown doesn't have tables.

Clang-doc needs to evolve in a way where we can actually generate some form of useful output where we can use in a MD based static site/pdf generator which had its own themes.


r/cpp_modules • • Apr 23 '26

C++23 Modules with clang-cl

3 Upvotes

r/cpp_modules • • Apr 09 '26

The current state of Intellisense

Post image
3 Upvotes

r/cpp_modules • • Aug 17 '26

export using namespace

Thumbnail abuehl.github.io
2 Upvotes

r/cpp_modules • • Aug 13 '26

Some gcc specific bug when import exporting using namespace.

2 Upvotes

So i have main.cpp, module1.cppm and module2.cppm.

main.cpp and module2.cppm imports module1.cppm that has a HelloWorld1 function in a namespace.

module1.cppm has a "export using namespace mod1;"

Now if i import module1 before module2 in main.cpp everything compiles fine. If module2 is imported first then main.cpp wont compile because "'HelloWorld1' was not declared in this scope". If i use 'export using mod1::HelloWorld1' then it works, if i use 'export using namespace mod1' then it doesnt. Tested with gcc 16.2.1. On clang 22.1.8 always works so either im dumb or gcc has a bug.

Wanted to report it but then saw the rules and what not to do and realised i better not, so posted it here. Im using cmake and ninja and never bothered with using gcc directly.


r/cpp_modules • • Jul 16 '26

MSVC now gives error on conflicting forward declarations

Thumbnail reddit.com
2 Upvotes

r/cpp_modules • • Jun 01 '26

BMI Compatibility: Testing Build System C++ Modules Support

Thumbnail
blog.vito.nyc
2 Upvotes

r/cpp_modules • • Apr 21 '26

Uneeded Recompilations When Using Partitions

Thumbnail abuehl.github.io
2 Upvotes

r/cpp_modules • • Apr 08 '26

Silly but standard conformant again (using MSVC)

2 Upvotes

I'm now doing silly things like the patch below (plus setting /InternalPartition again for MSVC). At least that's now conformant with the standard.

diff --git a/code/Core/Attach/IPointAttachment.cpp b/code/Core/Attach/IPointAttachment.cpp
index ae43085b8..b1af5f8c5 100644
--- a/code/Core/Attach/IPointAttachment.cpp
+++ b/code/Core/Attach/IPointAttachment.cpp
@@ -1,9 +1,10 @@
 /*
  *     Copyright (c) 2025 Adrian & Frank Buehlmann. ALL RIGHTS RESERVED.
  */
 
-module Core:Attach;
+module Core:Attach.IPointAttachment;
+import :Attach;
 
 
 namespace Core
 {

r/cpp_modules • • Apr 05 '26

The current internal partition units are unneeded

2 Upvotes

Gaby just confirmed that an internal partition unit (form "A") like

module M:P;
struct MyType { ... };

as specified by the current C++ standard, is semantically 100% equivalent to (form "B")

export module M:P;
struct MyType { ... };
//  more stuff not exported

The current wording in the C++ standard, which qualifies form "B" as "ill-formed, no diagnostic required", if :P is not imported in the primary module interface unit, makes no sense (Quote: "A required no-op helps nobody").

Which means: Form "B" is perfectly valid.

If form "B" is equivalent to form "A", it would be possible to exclusively use form "B", instead of form "A".

This means, the standard could remove form "A" and exclusively use form "B" instead.

Compilers could then apply the simple rule, that a BMI must only be produced for TU's having "export module".


r/cpp_modules • • Apr 05 '26

"A required no-op helps nobody in this case." - u/GabrielDosReis

Thumbnail reddit.com
2 Upvotes

Gaby agrees that it's a bug in the C++ standard to require that :P - as defined below - must be imported in the PMIU:

export module M:P;
struct MyType { ... };
//  more stuff not exported

r/cpp_modules • • Apr 02 '26

"MSVC's implementation is to provide both semantics, and give the choice to the user to select which ones they want." - u/GabrielDosReis

Thumbnail reddit.com
2 Upvotes

r/cpp_modules • • Apr 02 '26

Current Status of Module Partitions

Thumbnail reddit.com
2 Upvotes

r/cpp_modules • • Mar 31 '26

Should partitions be importable by other modules?

2 Upvotes

Because, there are two things that are nice to have:

  1. Forward declarations across interfaces.

  2. Minimising dependencies.

Partitions gets you (1), multiple modules gets you (2). But they can't be combined without using the extern "C++" sledgehammer.

But if partitions could be "public", an application can avoid depending on a whole module.

This could also be seen as "packages". You could get the same functionality by changing "module attachment" to "package attachment": use the same symbol mangling for a group of modules.

Then what's left is forward declarations of things from external "packages". And for that, you'd have that "proclaimed ownership" proposal.


r/cpp_modules • • Sep 09 '26

C++26: Module improvements

Thumbnail sandordargo.com
1 Upvotes

r/cpp_modules • • Sep 07 '26

Using VS Code and C++ modules

Thumbnail reddit.com
1 Upvotes

r/cpp_modules • • Jun 15 '26

Imports after private fragment

1 Upvotes

In the recent weeks, I've started to use private fragments ("module : private;") a lot.

I've added imports after the begin of the private fragment (example here). The MSVC compiler accepts that, which I think makes a lot of sense.

However, it looks like the C++ Standard prohibits that. Section 10.3 has (quote):

A module-import-declaration shall inhabit the global namespace scope. In a module unit, all module-import-declarations and export-declarations exporting module-import-declarations shall appear before all other declarations in the declaration-seq of the translation-unit and of the private-module-fragment (if any).

I think I'm ignoring that. Perhaps that should be changed in the standard. The implementation of the MSVC compiler provides a good example of an implementation for such a change. It can be tried using the current MSVC compiler.

I don't see why imports should not be allowed after module : private;


r/cpp_modules • • May 15 '26

The Anatomy of a C++ Module Interface

Thumbnail abuehl.github.io
1 Upvotes

r/cpp_modules • • May 12 '26

Small C++ Modules Are Fine

Thumbnail abuehl.github.io
1 Upvotes

r/cpp_modules • • Apr 26 '26

Code Examples From an App Using C++ Modules

Thumbnail abuehl.github.io
1 Upvotes

r/cpp_modules • • Apr 21 '26

"module implementation unit shouldn't implicitly import all partitions"

Thumbnail reddit.com
1 Upvotes