| Issue |
184361
|
| Summary |
[LifetimeSafety] False negative for std::optional and -> operator
|
| Labels |
false-negative,
clang:temporal-safety
|
| Assignees |
|
| Reporter |
usx95
|
```cpp
#include <optional>
#include <string>
#include <string_view>
struct TypeParamType {
std::string_view name() [[clang::lifetimebound]];
};
void foo() {
// No error. Bad.
std::string_view a;
a = std::optional<TypeParamType>()->name();
(void)a;
// Error. Good.
a = *std::optional<std::string>();
(void)a;
// No error. Bad.
const char* p = std::optional<std::string>()->data();
(void)p;
}
```
https://godbolt.org/z/bo1bnd1M5
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs