Issue 142801
Summary -Wdangling-gsl only diagnoses first template argument
Labels new issue
Assignees
Reporter DKLoehr
    We just ran into a bug where we have a gsl::Owner type which holds two values. We found that the `-Wdangling-gsl` warning correctly detects unsafe conversions such as `string` -> `string_view`, but only for the type which is listed first in the template arguments.

Simplified example: https://godbolt.org/z/Y56eWv74Y

Walking through the code, it seems that this is because [this line](https://github.com/llvm/llvm-project/blob/54d544b83141dc0b20727673f68793728ed54793/clang/lib/Sema/CheckExprLifetime.cpp#L318) only checks the first template argument, rather than all of them. Is there a reason why? Intuitively, it seems that we should be checking if _any_ of the types are pointer-like. Does that introduce false positives?
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to