<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/62112>62112</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [C++20] [Modules] Compilation failure std module without magic comment
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:modules
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          mordante
      </td>
    </tr>
</table>

<pre>
    @AaronBallman @ChuanqiXu9 I was testing with #61446. Using `-Wno-reserved-module-identifier` fixes the reserved module name diagnostic. But it fails to build a module without the magic comment `# 1 __FILE__ 1 3`

Tested with the nightly Clang 17 (20230412031217+76e407084330-1~exp1~20230412151227.862)

```
# 1 __FILE__ 1 3
// -*- C++ -*-

module;
#include <latch>

export module std:latch;
export namespace std {
  using std::latch;
} // namespace std
```

This compiles using the following command
`clang++-17 -std=c++2b -stdlib=libc++ --precompile -Wno-reserved-module-identifier -o /tmp/latch.o latch.cppm`

After removing the first line compilation fails 
```
latch.cppm:5:1: error: export declaration can only be used within a module purview
export namespace std {
^
latch.cppm:1:1: error: missing 'module' declaration at end of global module fragment introduced here
module;
```

Renaming the module to `latch` fixes compilation.



</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVEtv8zYQ_DX0ZSGDD7180MGOY-AD2kvRor0FFLWWWFCkSlJOcvl-e6GHEzsx0AKGZFLL4czu7MoQdGsRK5IdSHbcyDF2zle98420ETe1a94rktK99M4epDG9tEBS-tSN0v6j_xp38ANeZYCIIWrbwquOHRAucpam-Rb-CNMmyWnyp3WJx4D-gk3Su2Y0mOgGbdRnjZ7kFM76DQPEDuEaB0scWNkjNFq21oWo1RYOYwQd4Sy1CRAd1KM2Dchr_ETCjXHG6mWrFSjX92jjxIRwAQxeXk4_fnl-eQEGYtqkR0L3y_N3DBGbRcmEYHXbRfMOT0baFlgBhJecckFTxqlgnBWEH4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