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

    <tr>
        <th>Summary</th>
        <td>
            `-fdelayed-template-parsing` and `-fmodules-local-submodule-visibility` don't work together
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug,
            clang:modules,
            rejects-valid
      </td>
    </tr>

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

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

<pre>
    Under `-fmodules-local-submodule-visibility`, declaration visibility is not monotonically increasing within a compilation; when we enter a module, we hide declarations from elsewhere to prevent them leaking through to places they shouldn't be visible.

Under `-fdelayed-template-parsing`, we don't parse function template definitions immediately and instead defer parsing the template to its first instantiation.

If both features are enabled, function template definitions can be parsed in a context where declarations that they use are no longer visible. Consequently, test failures can be seen eg. by adding `-fdelayed-template-parsing` to the tests in `test/Modules/submodule-visibility.cpp`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNk89unDAQxp8GLiMQC-wSDhzyR5V66LEPMNgDuDE2tc1ut0_fMWSbRKqaSMjAjO35fd_YvZXX7ruR5CA5FdkwW7lq8pm2AnXm134PZGflVa-0CleelpSPIElodBiUNfCaBOXB2ACz5dEaxZtoDhrhCL0yI1xUmJQBBGHnReltfVI9wGUiAxcCMoFREPaysRAHJyXpbUEPg7MzkPbE6xxBsLA4OvNiCBPNoAmfY7UwObuO05bXKMjH9BX8ZFctTVI2AXra8TXlSfGUFPf7-MYSSRqvJLNAM28SKFvQRS0vRjCftPteMUEwrEZsttwWMPqgjNrJ1TyTVBxlX9BI9sYHQhnncMGXrSPm63KmV4E1K-fDNh9NUJsR75C_DtDbMMFAGFbHWtFFP5GlyQj6fy6BJnqxSYhUW4u4Gb8C7B6_8z9MGHYvV1YcCxkL2pqRNdzshEeeST9X7oq-RoBAzD-g0hvdS0FP3Hgac-jZDymj-I9cj4bsBnm2hVE5Fr-T8su3_fjy17-Obi6WhefmKXWH06k8NIeyrlPZVbKtWkyDCpq6D6vHrn3-rvw9HBfrnpl8JEZ36ep0N4Ww-KS6Z1p-Rr4Za5_zveAfrc-3V7Y4-4NEVKe8Xzdxx-ZYNenU0ZEarFtZtXQqh8MgaLg7CHGqq_aub4hSjT3fki45PiRl2a8jj7ET_OJmspzqfr45dks4itV8dkatZAwfn1LVlUVZFm1RFeWhLup8EGXVFgds6O6IrZBJXdDMnc0jcW7dmLpug-eanpNacatek-i9Gg3RBsb74xom67rf19Fqq2S6Ce02lX8AJ9Gabg">