llvm / llvm/llvm-project

[LifetimeSafety] False negative with annotated code and inheritance

Open
#199,669 0 comments 0 reactions 0 assignees View on GitHub
clang:temporal-safety
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Example: https://godbolt.org/z/ohsnqdd1o

```
#include
#include
#include

struct [[gsl::Owner]] String : public std::string {
using std::string::string;
};
struct [[gsl::Pointer]] StringView : public std::string_view {
void operator=(const String& s) {
static_cast(this)->operator=(s);
}
};

void simple_dangle() {
StringView v;
{
String s = "hello";
v = s;
}
std::cout << v;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.