[PATCH] D90123: [Sema] Improve notes for value category mismatch in overloading

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 25 10:09:53 PDT 2020


aaronpuchert created this revision.
aaronpuchert added reviewers: aaron.ballman, rsmith.
Herald added subscribers: cfe-commits, dexonsmith.
Herald added a project: clang.
aaronpuchert requested review of this revision.

When an overloaded member function has a ref-qualifier, like:

class X {

  void f() &&;
  void f(int) &;

};

we would print strange notes when the ref-qualifier doesn't fit the value
category:

X x;
x.f();
X().f(0);

would both print a note "no known conversion from 'X' to 'X' for object
argument" on their relevant overload instead of pointing out the
mismatch in value category.

At first I thought the solution is easy: just use the FailureKind member
of the BadConversionSequence struct. But it turns out that we weren't
properly setting this for function arguments. So I went through
TryReferenceInit to make sure we're doing that right, and found a number
of notes in the existing tests that improved as well.

Fixes PR47791.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90123

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaOverload.cpp
  clang/test/CXX/drs/dr14xx.cpp
  clang/test/CXX/drs/dr1xx.cpp
  clang/test/CXX/drs/dr6xx.cpp
  clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
  clang/test/SemaCXX/overload-member-call.cpp
  clang/test/SemaCXX/rval-references-examples.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90123.300545.patch
Type: text/x-patch
Size: 12653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201025/99e9d9d2/attachment-0001.bin>


More information about the cfe-commits mailing list