================
@@ -493,6 +515,43 @@ MyObj& reference_return_of_local() {
// expected-note@-1 {{returned here}}
}
+int* trivial_int_uar() {
+ int *a;
+ int b = 1;
+ a = &b; // expected-warning {{address of stack memory is returned
later}}
+ return a; // expected-note {{returned here}}
+}
+
+TriviallyDestructedClass* trivial_class_uar () {
+ TriviallyDestructedClass *ptr;
+ TriviallyDestructedClass s;
+ ptr = &s; // expected-warning {{address of stack memory is returned
later}}
+ return ptr; // expected-note {{returned here}}
+}
+
+// FIXME: No lifetime warning for this as no loans are issued for paramters
+const int& return_parameter(int a) {
+ return a;
+}
+
+// FIXME: No lifetime warning for this as no loans are issued for paramters
----------------
kashika0112 wrote:
Done. PTAL
https://github.com/llvm/llvm-project/pull/168855
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits