<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/106372>106372</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Respect the lifetimebound in assignment operator.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend,
            clang:diagnostics
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          hokein
      </td>
    </tr>
</table>

<pre>
    https://godbolt.org/z/43nf1v349

```
#include <vector>
#include <string>

template <typename T>
class  StatusOr {
public:
  template <typename U = T>
  StatusOr(U&& t [[clang::lifetimebound]]);

  template <typename U = T>
  StatusOr& operator=(U&& v [[clang::lifetimebound]]);
};

void test() {
 StatusOr<std::string_view> foo = std::string(); // #1 good, clang emits dangling diagnostic
  foo = std::string(); // #2, no dangling diagnostic
}
```

In the above example, clang doesn't catch the case 2, it would be nice to catch this case. We can assume that all assignment operators with a typical return type (`const reference&`) always return *this.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVMGO4zYM_Rr6QmxgS04cH3xINhugpwJtFz0WskTbamXJsGhPp19fyJmZTAfpYRYQZAiPenzko6VitL0namB_hv0lUwsPYW6G8BdZn7XBPDcD8xRBnkBcQVz7YNrgeBfmHsT1HxDXUvquWGVZQ36B_PSyH_KXdTsKab12iyEE-XUlzWEG-e0RGHm2vr-D2840Tk7xFsDPE3k1Ev72FqSdihHxV1a8xJ9nhOp8A6aldVYn8dsR8SHRdwR5eUd3ZwJx_A7iAOKAjFuLztqpJO8E8uRsR2xHasPiDewvaYka5Pm99B_IecAw0ay2Hl3eSVg_L6G6fJCzBmuQKTKII4j63qp7_uSBudHfzPhjtfQE8ht2IWyyP-A3KpBnvM0IgpAF9iEYEF9xU4s0Wo5olO-d9T0aq3ofIlv9Wv4nuEWi9eH_2VLZD8dw23_yyAOhasNKSH-rcXJ0F2oCRQ-iYtSK9bCFahUJt6yW8SkszmBL6K0m5PAWZ-MWuMPf0w2PKsZlJORBMSrn8PavjeT5zd-IT5YHVMjPk9XK4Uy8zD4dCVPph1wHHxln6mgmrymNwiFPzin3pJ7j6w0Qp6Rgl5lGmlrWKqOmqER5LGUty2xoatGZvOrk3lRC1XlZ10XXdfu6lLI6qLrObCNyUeZHcSyK4riXu7qiqiwKIfK6bqUxUOY0Kut2zq1jegAyG-NCTZEfZCUyp1pycXtIhHgd0W4OnskbEKl974C7ZTFh-0s2N4n3S7v0Ecrc2cjxnoktO2p-oTiR5s2T_0w-Wv-ovbtsmd3HB8zysLQ7HUYQ18T_8vkyzeFP0gziupUVQVxfKlsb8W8AAAD__78VkKo">