[all-commits] [llvm/llvm-project] 6f8477: [Sema] Improve notes for value category mismatch i...

Aaron Puchert via All-commits all-commits at lists.llvm.org
Sun Nov 15 09:06:01 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6f84779674a9764c6adee29b9a48ed3b3f0d5132
      https://github.com/llvm/llvm-project/commit/6f84779674a9764c6adee29b9a48ed3b3f0d5132
  Author: Aaron Puchert <aaronpuchert at alice-dsl.net>
  Date:   2020-11-15 (Sun, 15 Nov 2020)

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

  Log Message:
  -----------
  [Sema] Improve notes for value category mismatch in overloading

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.

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D90123


  Commit: dea31f135ceae6e860e6301f9bb66d3b3adb1357
      https://github.com/llvm/llvm-project/commit/dea31f135ceae6e860e6301f9bb66d3b3adb1357
  Author: Aaron Puchert <aaronpuchert at alice-dsl.net>
  Date:   2020-11-15 (Sun, 15 Nov 2020)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
    M clang/test/CXX/dcl/dcl.fct/p17.cpp
    M clang/test/CXX/drs/dr14xx.cpp
    M clang/test/CXX/drs/dr1xx.cpp
    M clang/test/CXX/drs/dr6xx.cpp
    M clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
    M clang/test/Misc/integer-literal-printing.cpp
    M clang/test/OpenMP/atomic_messages.c
    M clang/test/OpenMP/atomic_messages.cpp
    M clang/test/OpenMP/nesting_of_regions.cpp
    M clang/test/Sema/heinous-extensions-off.c
    M clang/test/Sema/heinous-extensions-on.c
    M clang/test/SemaCXX/overload-member-call.cpp
    M clang/test/SemaCXX/recovery-expr-type.cpp
    M clang/test/SemaCXX/rval-references-examples.cpp
    M clang/test/SemaCXX/user-defined-conversions.cpp
    M clang/test/SemaObjC/arc.m
    M clang/test/SemaTemplate/constructor-template.cpp

  Log Message:
  -----------
  Consistent spelling in diagnostics: {l,r}value instead of {l,r}-value

As Richard Smith pointed out in the review of D90123, both the C and C++
standard call it lvalue and rvalue, so let's stick to the same spelling
in Clang.


Compare: https://github.com/llvm/llvm-project/compare/d2acf2292792...dea31f135cea


More information about the All-commits mailing list