[clang] [Clang][Concepts] Fix a constraint comparison regression for out-of-line ClassTemplateDecls (PR #102587)

Qizhi Hu via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 9 07:42:48 PDT 2024


jcsxky wrote:

> Note that @jcsxky has a similar patch #102554 that fixes the same thing. I don't intend to contend against him, and admittedly, that patch works.
> 
> But I don't think that approach is so reasonable because it is hacky in that `ForConstraintInstantiation` is disabled in the presence of `ClassTemplateDecl`s, which seemingly does a superfluous job that `getTemplateInstantiationArgs()` should do and blurs the meaning of the flag.
> 
> That would also leave us a concern about whether we should change all the other lines where `ForConstraintInstantiation` was true to the same pattern in `SubstituteConstraintExpressionWithoutSatisfaction`.

The approach in this patch does not work on the following case:
```cpp
template<typename>
concept Constrained = true;

template <typename T>
class C
{
    template<Constrained>
    class D;
};

template <>
template <Constrained>
class C<int>::D
{
};
```
while mine does.

https://github.com/llvm/llvm-project/pull/102587


More information about the cfe-commits mailing list