[PATCH] D150212: [clang][Sema] Improve diagnostics for auto return type

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 9 11:16:44 PDT 2023


yaxunl created this revision.
yaxunl added reviewers: tra, rjmccall, rsmith.
Herald added a project: All.
yaxunl requested review of this revision.

Currently when clang fails to deduce auto return type of a function,
it does not emit any notes about why it fails. This causes difficulty
for users to fix such errors.

Actually, clang already generates the information for emitting notes
about the failed deduction. There is a TODO for actually emitting
them.

This patch tries to implement the TODO. Basically it passes the
failed template specialization candidate set from the point of
specialization failure back to the point where the deduction starts.

It is not comprehensive but would be a start for further improvement.


https://reviews.llvm.org/D150212

Files:
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Sema/TemplateDeduction.h
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/test/SemaCXX/auto-type-from-cxx.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150212.520759.patch
Type: text/x-patch
Size: 12670 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230509/3047de5a/attachment-0001.bin>


More information about the cfe-commits mailing list