[PATCH] D126907: Deferred Concept Instantiation Implementation Take 2

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 16 02:57:13 PDT 2022


ChuanqiXu added a comment.

>From what I can see, the crash reason would be the mismatch depth and the setting of MultiLevelTemplateArgumentList. In `::CheckConstraintSatisfaction`, the depth of `RawCompletionToken ` is 0, while the depth of corresponding MultiLevelTemplateArgumentList is 2. So the compiler would get the outermost template argument incorrectly (which is a template pack in the example) in TransformTemplateTypeParmType.

The first though was that we should set the depth of `RawCompletionToken ` to 1 correctly. But I felt this might not be good later since in the normal process of template instantiation (without concepts and constraints), the depth of `RawCompletionToken ` is 0 indeed. What is different that time is the depth of corresponding `MultiLevelTemplateArgumentList ` is 1. So it looks like the process is constructed on the fly. It makes sense for the perspective of compilation speed.

So I feel like what we should do here is in `Sema::CheckInstantiatedFunctionTemplateConstraints`, when we are computing the desired MultiLevelTemplateArgumentList, we should compute a result with depth of 1 in the particular case.

---

Another idea is to not do instantiation when we're checking constraints. But I need to think more about this.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126907/new/

https://reviews.llvm.org/D126907



More information about the cfe-commits mailing list