[clang] Fix out of line Concept-comparisons of NestedNameSpecifiers (PR #65993)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 11 14:04:20 PDT 2023


erichkeane wrote:

So the latest patch doesn't FIX it, it has a problem with: 

``` 
template<typename T> concept Concept = true;

template<int>
struct S { 
struct Inner0 {
struct Inner1 {
template<Concept C>
static constexpr int method();
};
};
};

template<>
template<Concept C>
constexpr int S<1>::Inner0::Inner1::method() { return 0;}
```

The problem/special case here is the `template<>`, which causes there to be no level of 'template parameters' when filling in the Depths of the method.  HOWEVER, our `NestedNameSpecifier` list ends up finding the `1` there (for obvious reasons), so the replacement is wrong.

I don't have a feeling of how to get those, I thought the `NNS` was a good analog, but it is clearly not.  I suspect this might be the source of other similar/awkward issues elsewhere.

At the moment, I'm done with this for at least the night, so if someone else wants to take a look, they are encouraged to share their' findings.

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


More information about the cfe-commits mailing list