StefanPaulet wrote:

The trace that I found was:
- return type for `dispatch` must be deduced
- `dispatch` is instantiated
- `callable()` is instantiated as part of `LocalEagerInstantiationScope` 
(calling `PerformPendingInstantiations`)
- `InstantiateFunctionDefinition` for `callable()` is called with 
`Recursive=true`
- A `GlobalEagerInstantiationScope` is created with `/*Enabled=*/ Recursive = 
true`
- `foo` is eagerly instantiated from `GlobalInstantiations.perform()`

The issue comes from the fact that `Sema::PerformPendingInstantiations` calls 
`InstantiateFunctionDefinition` with both `Recursive=true` and 
`AtEndOfTU=true`. I was not sure about when `Recursive` should be enabled so I 
did not touch it. Could you shed some light on its purpose please?

As for the diagnostics issue, I think it can be solved if I only try a second 
instantiation for implicit instantiations. Diagnostics for implicit 
instantiations only get emitted at the end of the TU. Also, implicit 
instantiations seem to be the only ones that cause this issue, as I haven't 
been able to replicate this behaviour otherwise.

https://github.com/llvm/llvm-project/pull/117167
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to