================
@@ -0,0 +1,30 @@
+.. title:: clang-tidy - bugprone-return-const-ref-from-parameter
+
+bugprone-return-const-ref-from-parameter
+========================================
+
+Detects the function which returns the const reference from parameter which
+causes potential use after free if the caller uses xvalue as argument.
+
+In c++, const reference parameter can accept xvalue which will be destructed
+after the call. When the function returns this parameter also as const 
reference,
+then the returned reference can be used after the object it refers to has been
+destroyed.
----------------
SimplyDanny wrote:

```suggestion
In C++, constant reference parameters can accept xvalues which will be 
destructed
after the call. When the function returns such a parameter also as constant 
reference,
then the returned reference can be used after the object it refers to has been
destroyed.
```

https://github.com/llvm/llvm-project/pull/89497
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to