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

    <tr>
        <th>Summary</th>
        <td>
            [Modules][libc++] Can't use modules with precompiled headers and libc++
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

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

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

<pre>
    I'm trying to build a project that uses C++20 modules and precompiled headers at the same time. When I use the LLVM libc++ library in such a scenario, I get a build error. 
If I use GCC libstdc++ instead of LLVM libc++, the build goes correctly.
The build also passes correctly if I don't use precompiled headers (write `#include` inside source files).\
Build log is attached as an attachment.\
Also, [here's](https://github.com/Algorithm0/modules-and-pch-libcxx-bug) a repo that cannot build with libc++.

[build_log.txt](https://github.com/user-attachments/files/19650286/log.txt)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEk0GvqzYQhX_NsBkFmQESWLBIckV1pfd2VbusHHsCrgyObPPezb-vTLhNVF31SUiAbJ85842PDMEMM3MH9Qnqt0wucXS-O9rBeRPHSWQXp-_dO9BhwujvZh4wOrwsxmqUePPub1YR4ygjLoEDnoFOQCcSODm9WA4oZ403z8pNN2NZ48hSsw8o0zHGICfGaCbO8c-RZ3xPOuvKt29_fEdrLuohmT699Hc0M4ZFjSgxKJ6lNw7ojO84cES5WWPvnc8RxPH9ukn-dj4niRD1p6CZQ2Sp0V3_WysJJgsPscFxQOW8ZxXtPQdx_P3fNWmDw5sM4XULmlRUuxnosHL5EgBQ89ObyAh7AVSaWdlFM-xFMmY0Y3CLV4xXYzkAtTnUZxDH01rXugFNghilGlmjTKC334nnuG0-2rDSgfo0smegQ4D6DagZY7wFKI9APVA_mDgul1y5Cah_Dh-o36a4k7Pe3dS4S4w-PnaXZQBqUaLnm3uMX8l5dnHD8tPE8YVnYpae-rQu_2XdkMeP-EsrS2C_ezYVgPqNRl-0-1pQswfqP9WozXRX6rZsZcZdcaiqggS1RTZ2ippS7atKHg6k20JJpWTN3BS6bfctXzPTkaBaVKIpyrooi1w0uhDETXktRF2WB6gET9LY3NofU-78kJkQFu6KsmrqOrPywjasMSJ6vUiUYuW7dCpRC1AJa0IMT51ool0D-P3BOlGpTy8a9Rue5fMufQZrZfxlsmb9wj5bvO3-h3Hysb12W56B-rW5lfOjvx8d_RMAAP__OopYhQ">