| Issue |
238085
|
| Summary |
[clang] `-Wlifetime-safety-lifetimebound-violation` false positive with struct
|
| Labels |
clang,
false-positive
|
| Assignees |
|
| Reporter |
davidstone
|
Compiling
```c++
struct s {
int const & m;
};
auto f([[clang::lifetimebound]] int const & x) -> s {
return s{x};
}
```
with `-Wlifetime-safety-lifetimebound-violation` causes
```console
<source>:5:10: warning: could not verify that the return value can be lifetime bound to 'x' [-Wlifetime-safety-lifetimebound-violation]
5 | auto f([[clang::lifetimebound]] int const & x) -> s {
| ^~~~~~~~~~~~~~~~~~~~
1 warning generated.
Compiler returned: 0
```
See it live: https://godbolt.org/z/eE69G7f7q
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs