[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 07:00:20 PST 2025


hokein wrote:

> Discovered a new false positive, similar to #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;
> };
> ```

Fixed in the latest commit (https://github.com/llvm/llvm-project/pull/122088/commits/3276f4ef1fa3ea9c5b27f4f7eac055c594737d74). Please take another look @usx95, @Xazax-hun 

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


More information about the cfe-commits mailing list