================
@@ -704,10 +704,10 @@ void FactsGenerator::handleFunctionCall(const Expr *Call,
         assert(!Args[I]->isGLValue() || ArgList->getLength() >= 2);
         ArgList = getRValueOrigins(Args[I], ArgList);
       }
-      if (isGslOwnerType(Args[I]->getType())) {
-        // The constructed gsl::Pointer borrows from the Owner's storage, not
-        // from what the Owner itself borrows, so only the outermost origin is
-        // needed.
+      if (isGslOwnerType(Args[I]->getType()) || IsArgLifetimeBound(I)) {
+        // The constructed gsl::Pointer is dependent on the argument itself, 
not
----------------
NeKon69 wrote:

So I've been investigating this, but I just couldn't find a way for my code to 
fail. I wrote something like this, and it warns in both cases on both my 
version and the updated version that (that is in a separate branch and uses 
`flow`).

```cpp
template <typename T>
struct Vec {
  Vec(T n);
};

template <typename T>
struct [[gsl::Pointer]] Span {
  Span();
  Span(const T &v [[clang::lifetimebound]]);
  const T &operator*() const [[clang::lifetimebound]];
};

template <typename T>
void use(T);

void test1() {
  Span<Span<Vec<int>>> s;
  {
    Vec<int> v{5};
    s = Span(Span(v));
  }
  use(*s);
}

void test2() {
  Span<Span<Vec<int>>> s;
  {
    Vec<int> v{5};
    s = Span(Span(v));
  }
  use(**s);
}
```

Maybe I am missing something or doing something wrong? 
Could you please provide a more concrete example of what you mean?

https://github.com/llvm/llvm-project/pull/189907
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to