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

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 25 02:07:55 PDT 2025


ChuanqiXu9 wrote:

> > See also https://cplusplus.github.io/CWG/issues/2947.html.
> 
> Note that it not only suggests wording changes necessary to achieve the intent of https://wg21.link/p3034, it also has a number of examples demonstrating that the wording allows
> 
> ```c++
> export module m; int n;
> ```
> 
> The above works with Clang before this PR:
> 
> ```
> $ oldclang -std=c++26 -fsyntax-only -xc++-module -<<<$'export module M; int n;'
> Return:  0x00:0   Wed Sep 24 19:36:21 2025 EDT
> ```
> 
> but stops working with the PR in its current form:
> 
> ```
> $ clang -std=c++26 -fsyntax-only -xc++-module -<<<$'export module M; int n;'
> <stdin>:1:18: warning: extra tokens at end of 'module' directive [-Wextra-tokens]
>     1 | export module M; int n;
>       |                  ^
>       |                  //
> <stdin>:1:24: error: expected unqualified-id
>     1 | export module M; int n;
>       |                        ^
> 1 warning and 1 error generated.
> Return:  0x01:1   Wed Sep 24 19:37:13 2025 EDT
> ```

It is hard to believe it is by design to allow "export module m; int n;" while we reject others. Is is possible to adjust the wording for it?

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


More information about the cfe-commits mailing list