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

    <tr>
        <th>Summary</th>
        <td>
            Add escape hatch for using modules with reserved names
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:modules,
            new-feature
      </td>
    </tr>

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

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

<pre>
    According to the Standard modules named `std` (and some variations) are reserved for the implementation. While implementing the module `std` in libc++ ([P2465](https://wg21.link/P2465)) Clang considers the code ill-formed due to the usage of a reserved module name. @ChuanqiXu9 provided a work-around by using `# 1 __FILE__ 1 3` in the `.cppm` file. This works. but feels quite fragile. When this line is not on line 1 the diagnostics will show the wrong line number, which is expected. (I ran into that several times, therefore I now have them at line 1.)

It would be great to have a way to tell Clang a specific module is part of the implementation and thus is allowed to use reserved names. For example using a compiler switch (to disable this diagnostic) or something like `#pragma system_file`. I'm not sure what the easiest solution in Clang is. For now this is an issue for libc++, but I expect the same issue will occur when libstdc++ implements its `std` module. (I don't know whether GCC will issue a diagnostic when using reserved module names.)

@AaronBallman I understood from @ChuanqiXu9 that you were involved in the discussion regarding the current behaviour.

Note this is not a blocker for libc++, but it's inconvenient.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VUtv4zYQ_jX0ZRBBpvzSwYc86sJAURRoge0tGIkjaRqK9HJIa_PvC8rKxt22lwSmhzPzvWgU4d4RHdX2SW1fVpji4MNx9MGgi7RqvHk_PratD4ZdD9FDHAh-j-gMBgOjN8mSgMORDKhdKdGoXQlKH9AZED8SXDEwRvZOlK4BA0EgoXAlA50Pcz8eL5ZGcnGuK-DLwPbudJ480DLtbgw7sNy0Sj8p_ZSHqu3Tb3qz26rti9KHIcaLqOpR6ZPSp6nX68Kye1P6dCvSdd7o2aLrofVO2FCQeVLrDQFb-9D5kJG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