[all-commits] [llvm/llvm-project] ec6c5e: [clang] Improve diagnostics for auto-return-type f...

Haojian Wu via All-commits all-commits at lists.llvm.org
Mon Nov 30 00:24:11 PST 2020


  Branch: refs/heads/temp-test-main
  Home:   https://github.com/llvm/llvm-project
  Commit: ec6c5e920a89db0e1c5f73b8349ee0b84192072d
      https://github.com/llvm/llvm-project/commit/ec6c5e920a89db0e1c5f73b8349ee0b84192072d
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2020-11-30 (Mon, 30 Nov 2020)

  Changed paths:
    M clang/lib/Sema/SemaStmt.cpp
    M clang/test/SemaCXX/attr-target-mv.cpp
    M clang/test/SemaCXX/cxx1y-deduced-return-type.cpp
    M clang/test/SemaCXX/lambda-expressions.cpp

  Log Message:
  -----------
  [clang] Improve diagnostics for auto-return-type function if the return expr had an error.

Given the following case:

```
auto k() {
  return undef();
  return 1;
}
```

Prior to the patch, clang emits an `cannot initialize return object of type
'auto' with an rvalue of type 'int'` diagnostic on the second return
(because the return type of the function cannot be deduced from the first contain-errors return).

This patch suppresses this error.

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




More information about the All-commits mailing list