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

    <tr>
        <th>Summary</th>
        <td>
            Lifetimebound does not detect reference to temporary string chained by member calls
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:diagnostics,
            clang:memory-safety
      </td>
    </tr>

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

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

<pre>
    https://godbolt.org/z/vTqzr81qf
```
#include <string>
#include <string_view>

struct S {
    const std::string& get() const;
    std::string sv;
};

const std::string& S::get() const [[clang::lifetimebound]] { return sv; };

struct T {
    const S& get() const;
    S s;
};

const S& T::get() const [[clang::lifetimebound]] { return s; }

std::string_view bar() {
    S s;
    std::string_view a = S{}.get(); // error. Ok.
    return s.get(); // error. Ok.
}

std::string_view foo() {
    T t;
    std::string_view a = T{}.get().get(); // No error. Bug.
    return t.get().get(); // No error. Bug.
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyslM-PmzoQx_-a4TLayDE4hAOHZHmcnt47JPfKmIG4NXjXNmmzf30FIbtpdrNVpUpIIObX5zuesfRetz1RDmILoojkEA7W5YP_kYmosvUpP4Tw5CHeAC-Bl62tK2vCwroWePkCvDzun1_cevncANvAis0P2wCPda_MUBNC_OiD030L8T93LF-Omr7PZrbxwQ0q4A4h3QLbICIq2_uAPtQjSryZ8_EVthSAr4FnZxeILxE3vuiPZxukxfzBNnez7s4_bpLj1KWtMnLUMjoY3VDQHVV26GsQBYhihEZHYXD9uSZeV5yl7d9J230qZof-Hv0UuP9LvBfcmfWXvkxnhJV0c4k3Ba90H_T9HCUR4gJ3Y0haLF4xp3LTYCE5Z90C__-2mPNckH7v_TlwY-074D3eH5Rr4P0t8Icw_9kLz3Zob_DDn8bOYi6bFNV5XGdxJiPKl6lIkpSLtYgOebPKEsliUSuRNSxTKxJKUhZzarhs1jzSOWdcsDVbsYxniVgsE0obJZYZrVJqmgQSRp3UZmHMsRs3OtLeD5QvBedpFhlZkfHTxcD5ZYRqLdve-qCVB86BP17ZOuqsOz142VA4jVZRRC4fkz9UQ-shYUb74N_KBR0M5f9ejyTWljz2NmBNgVRARw056hVhsBioe7JOuhPOO60OUvdUY3XCjrqKHCppjI8GZ24vLh0OQ7VQtgNejgTz6-HJ2a-kAvByUu-Bl3MDjjn_GQAA__9mQoE2">