Issue 183016
Summary [LifetimeSafety] Diagnose lifetimebound on definition but not on declaration
Labels clang:temporal-safety
Assignees
Reporter usx95
    ```cpp
#include <iostream>
#include <string>
#include <string_view>

std::string_view foo(std::string_view in);

std::string_view foo(std::string_view in [[clang::lifetimebound]]) {
    return in;
}
```
This leads to callers not seeing the `lifetimebound`, specially when the declaration is in header and definition is in an implementation file.

The policy should be: `lifetimebound` **must** be placed on a declaration and **maybe** placed on a definition.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to