hokein wrote:

Thanks for the patch! +1 on the idea of printing deduction guides in 
diagnostics. This improves the experience for both users and compiler 
developers. This is https://github.com/llvm/llvm-project/issues/92393 :)

> Perhaps an approach more similar to what we display for ambiguous cast paths 
> would be better, i.e., listing each implicit deduction guide we tried in a 
> single note.
>
> Thanks for suggesting a better approach. However, implementing this would 
> require significant changes to our diagnostic logic for overloads. We 
> currently explain the reasons for deduction failure in subsequent notes, with 
> around 16 different kinds of deduction failures, each with its own diagnostic 
> message. Given this complexity, I don't think it's necessary (or feasible) to 
> special-case CTAD guides for each note.

In my opinion, including the deduction guide in the existing note (e.g., 
`candidate template "template<class T> S()-> S<T>" ignored: ...`) is clearer 
and more concise. It seems that the current implementation in clang assumes all 
template candidates are written in the source code, which isn't true for the 
CTAD case. We could extend it to work for not-explicitly-written-in-source-code 
case. 
Although we have 19 `candidate template ignored` notes, they are mostly 
localized in `SemaOverload.cpp`. Extending them is possible but would require 
some work.

However, I don't feel strongly about this, and am also fine with the current 
implementation, as it has already improved the experience.





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

Reply via email to