[libcxx-commits] [clang] [libcxx] [llvm] Reapply "[Clang] Implement resolution for CWG1835 (#92957)" (PR #98547)

Krystian Stasiowski via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 19 17:36:03 PDT 2024


sdkrystian wrote:

> > @mizvekov Without unannotated tentative parsing (to be _properly_ introduced by #96364), issuing a warning is infeasible. Either way, by the time we detect the error we could be who knows how deep into the second operand of a `>` operator.
> 
> So when we are parsing `this->A`. Suppose what follows it looks like a template argument list. Then we see if `this->template A` would have found a template. if it does find the template `A`, we issue the warning and proceed as if the user had written `this->template A`
> 
> Do you think that's workable?

We already do that :) the problem is when what follows `A` _doesn't_ unambiguously look like a template argument list:

``cpp
int x = 0;

template<int I>
struct f { };

template<typename T>
void g(T t)
{
    t.f<0>::x; // could be interpreted as '((t.f) < 0) > (::x)'
}
```

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


More information about the libcxx-commits mailing list