Issue 177184
Summary Diagnose lifetimebound wrongly placed on non-pointer/ref parameter
Labels clang:temporal-safety
Assignees
Reporter usx95
    ```cpp
// Ok. 
std::string_view foo(const std::string& in [[clang::lifetime_bound]]) { return in; }

// Ok.
std::string_view bar(std::string_view in [[clang::lifetime_bound]]) { return in; }

// Not ok. Should diagnose. lifetimebound can only be applied to parameters with of pointer, reference or gsl::Pointer type.
std::string bar(std::string in [[clang::lifetime_bound]]) { return in; }
```
cc: @Xazax-hun 

As discussed, it should be possible to diagnose this. We should allow annotation only on types having a non-empty origin list.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to