[clang] [clang] Refine the temporay object member access filtering for GSL pointer (PR #122088)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 20 06:09:45 PST 2025


hokein wrote:

Discovered a new false positive, similar to https://github.com/llvm/llvm-project/pull/114213,

```
struct Bar {};

struct Foo {
   std::unique_ptr<Bar> bar;
};

struct Test {
  Test(Foo foo) : bar(foo.bar.get()), // bogus diagnostic: initializing pointer member 'bar' with the stack address of parameter 'foo'
      storage(std::move(foo.bar)) {};

  Bar* bar;
  std::unique_ptr<Bar> storage;
};
```

https://github.com/llvm/llvm-project/pull/122088


More information about the cfe-commits mailing list