You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang/test/SemaCXX/attr-lifetimebound.cpp
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -75,6 +75,18 @@ namespace usage_ok {
75
75
r = A(1); // expected-warning {{object backing the pointer 'r' will be destroyed at the end of the full-expression}}
76
76
}
77
77
78
+
// Test that lifetimebound on implicit 'this' is propagated across redeclarations
79
+
structB {
80
+
int *method() [[clang::lifetimebound]];
81
+
int i;
82
+
};
83
+
int *B::method() { return &i; }
84
+
85
+
voidtest_lifetimebound_on_implicit_this() {
86
+
int *t = B().method(); // expected-warning {{temporary whose address is used as value of local variable 't' will be destroyed at the end of the full-expression}}
87
+
t = {B().method()}; // expected-warning {{object backing the pointer 't' will be destroyed at the end of the full-expression}}
0 commit comments