[clang] failure to instantiate template specialization defined after use when used from generic lambda #125747
Labels
accepts-invalid
c++11
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
diverges-from:edg
Does the clang frontend diverge from edg compiler
diverges-from:gcc
Does the clang frontend diverge from gcc on this issue
diverges-from:msvc
Does the clang frontend diverge from msvc on this issue
rejects-valid
Reduced testcase:
This should compile and link, but does not, because Clang fails to instantiate
G<int>
at the end of the TU. (Accepts-invalid version for testsuite).Because
visit
and the lambda's call operator areconstexpr
, they'll get instantiated immediately, which will trigger an attempt to instantiateG<int>
, which will fail because it's not defined yet. But it should then get added to the pending instantiations list to be retried at the end of the translation unit, which appears to not be happening in this case.Curiously, this bug seems to require a lambda -- if the lambda is replaced by an equivalent struct, the bug disappears. Also, a direct call to the lambda does not trigger the bug; it must be indirectly called via another constexpr function.
The text was updated successfully, but these errors were encountered: