[clang] [Clang] Clarify diagnostic notes for implicitly generated deduction guides (PR #96084)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 24 03:58:13 PDT 2024


================
@@ -12114,6 +12115,35 @@ static void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand,
     return;
   }
 
+  // If this is an implicit deduction guide against an implicitly defined
+  // constructor, add a note for it. Neither these deduction guides nor their
+  // corresponding constructors are explicitly spelled in the source code,
----------------
hokein wrote:

I have a different perspective: I'd prefer printing them as long as they are synthesized (not part of the written source code).

While the example of combined template parameters might not be the best one (and I agree that understanding them from existing contexts is often sufficient), the conjunction of associated constraints for a class and the corresponding constructor is probably less obvious. I think printing them would make the situation clearer and help users avoid guessing. Moreover, this approach would be consistent with what GCC does.

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


More information about the cfe-commits mailing list