[clang] [C++20][Modules] Implement P1857R3 Modules Dependency Discovery (PR #107168)

Michael Spencer via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 9 18:32:11 PDT 2025


Bigcheese wrote:

> @Bigcheese I have a question about `A module directive may only appear as the first preprocessing tokens in a file (excluding the global module fragment.)`. IIUC, as you said in [#90574 (comment)](https://github.com/llvm/llvm-project/pull/90574#discussion_r1591569547), this rule intended to prohibit the following code?
> 
> ```c++
> // error: User need to have a `module;` decl before any preprocessor directives.
> #include "foo.h"
> export module M;
> ```

Yes, that's not valid according to to the grammar in [[cpp.pre]](https://eel.is/c++draft/cpp.pre).

https://github.com/llvm/llvm-project/pull/107168


More information about the cfe-commits mailing list