[PATCH] D74238: [clang] [clang] Improve diagnostic note for implicit conversion sequences that would work if more than one implicit user-defined conversion were allowed.

Logan Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 7 10:17:19 PST 2020


logan-5 created this revision.
logan-5 added a reviewer: rsmith.
logan-5 added a project: clang.
Herald added a subscriber: cfe-commits.

The current text of the 'note' diagnostic for bad conversions is confusing in the presence of user-defined conversion operations: https://godbolt.org/z/zrgeHH
For the first error, the conversion function is simply pointed at in a note without any further explanation. For the second error, the final note claims there is no conversion from X2 to Y2, even though it is plainly visible in the source code. The reason for the error is that only one implicit user-defined conversion may be applied in these circumstances, but the error message is misleading to those who may not know this rule.

This is determined by searching for these illegal conversions in CompleteNonViableCandidate after overload resolution fails.

Depends on D74234 <https://reviews.llvm.org/D74234>. Also depends on D74235 <https://reviews.llvm.org/D74235>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74238

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Overload.h
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaOverload.cpp
  clang/test/CXX/drs/dr0xx.cpp
  clang/test/SemaCXX/address-space-ctor.cpp
  clang/test/SemaCXX/constructor-initializer.cpp
  clang/test/SemaCXX/user-defined-conversions.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74238.243217.patch
Type: text/x-patch
Size: 13831 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200207/a8a9a1fc/attachment-0001.bin>


More information about the cfe-commits mailing list