https://bugs.llvm.org/show_bug.cgi?id=51967

            Bug ID: 51967
           Summary: gsl::Owner seems not to work on custom class
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

Looking at https://reviews.llvm.org/D64448 I was expecting a warning on both
lines inside of fun(), but I only get the warning with unique_ptr. Is this a
bug or am I not understanding who this should be used?

https://godbolt.org/z/571sYxad3

#include <memory>

template <typename T>
struct [[gsl::Owner]] my_unique_ptr
{
    T* m_p;
    T* get() const { return m_p; };
};

std::unique_ptr<int> get_unique_ptr();
my_unique_ptr<int> get_my_unique_ptr();

void fun()
{
    int* p1 = get_my_unique_ptr().get(); // no -Wdangling-gsl
    int* p2 = get_unique_ptr().get(); // -Wdangling-gsl
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to