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
+6
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,12 @@ namespace usage_ok {
40
40
int *p = A().class_member(); // expected-warning {{temporary whose address is used as value of local variable 'p' will be destroyed at the end of the full-expression}}
41
41
int *q = A(); // expected-warning {{temporary whose address is used as value of local variable 'q' will be destroyed at the end of the full-expression}}
42
42
int *r = A(1); // expected-warning {{temporary whose address is used as value of local variable 'r' will be destroyed at the end of the full-expression}}
43
+
44
+
voidtest_assignment() {
45
+
p = A().class_member(); // expected-warning {{object backing the pointer p will be destroyed at the end of the full-expression}}
46
+
q = A(); // expected-warning {{object backing the pointer q will be destroyed at the end of the full-expression}}
47
+
r = A(1); // expected-warning {{object backing the pointer r will be destroyed at the end of the full-expression}}
Copy file name to clipboardExpand all lines: clang/test/SemaCXX/warn-dangling-local.cpp
+2
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,10 @@ using T = int[];
4
4
5
5
voidf() {
6
6
int *p = &(int&)(int&&)0; // expected-warning {{temporary whose address is used as value of local variable 'p' will be destroyed at the end of the full-expression}}
7
+
p = &(int&)(int&&)0; // expected-warning {{object backing the pointer p will be destroyed at the end of the full-expression}}
7
8
8
9
int *q = (int *const &)T{1, 2, 3}; // expected-warning {{temporary whose address is used as value of local variable 'q' will be destroyed at the end of the full-expression}}
10
+
q = (int *const &)T{1, 2, 3}; // expected-warning {{object backing the pointer q will be destroyed at the end of the full-expression}}
9
11
10
12
// FIXME: We don't warn here because the 'int*' temporary is not const, but
11
13
// it also can't have actually changed since it was created, so we could
0 commit comments