erichkeane wrote:

> Well this took forever to reduce:
> 
> ```c++
> template<typename T>
> struct A;
> 
> template<typename T>
> bool operator==(const A<T>&, const A<T>&);
> 
> template<typename>
> void f(int *x)
> {
>     [&](auto *y) { return x == y; };
> }
> 
> void g()
> {
>     f<int>(nullptr);
> }
> ```
> 
> We initially build a `CXXOperatorCallExpr` during parsing for the comparison, 
> but `TreeTransform` prematurely rebuilds it as a builtin binary operator when 
> `f` is instantiated.

Yeah, unfortunately that is a limitation of Clang, we still don't correctly 
implement the instantiation of Lambdas.  We do so 'greedily', in a way that the 
standard doesn't allow.  We eventually need to delay ALL instantiation until 
the actual first full instantiation of the lambda.

That said, in this case I'm surprised that we don't skip that diagnostic based 
on the RHS (in your repro) being dependent.  THAT would probably fix this case 
at least.

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

Reply via email to