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
MyIntPointer p = Y{}.a; //expected-warning {{temporary whose address is used as value of local variable 'p' will be destroyed at the end of the full-expression}}
67
+
MyIntPointer p = Y{}.a; //TODO
60
68
(void)p;
61
69
}
62
70
63
71
structDanglingGslPtrField {
64
-
MyIntPointer p; // expected-note 2{{pointer member declared here}}
72
+
MyIntPointer p; // expected-note {{pointer member declared here}}
65
73
MyLongPointerFromConversion p2; // expected-note {{pointer member declared here}}
66
-
DanglingGslPtrField(int i) : p(&i) {} //expected-warning {{initializing pointer member 'p' with the stack address of parameter 'i'}}
74
+
DanglingGslPtrField(int i) : p(&i) {} //TODO
67
75
DanglingGslPtrField() : p2(MyLongOwnerWithConversion{}) {} // expected-warning {{initializing pointer member 'p2' to point to a temporary object whose lifetime is shorter than the lifetime of the constructed object}}
68
76
DanglingGslPtrField(double) : p(MyIntOwner{}) {} // expected-warning {{initializing pointer member 'p' to point to a temporary object whose lifetime is shorter than the lifetime of the constructed object}}
69
77
};
70
78
71
79
MyIntPointer danglingGslPtrFromLocal() {
72
80
int j;
73
-
return &j; //expected-warning {{address of stack memory associated with local variable 'j' returned}}
std::vector<int>::iterator it = std::vector<int>().begin(); // expected-warning {{object backing the pointer will be destroyed at the end of the full-expression}}
constint *val = v.data(); // Ok, it is lifetime extended.
300
332
}
333
+
334
+
voidhandleTernaryOperator(bool cond) {
335
+
std::basic_string<char> def;
336
+
std::basic_string_view<char> v = cond ? def : ""; // expected-warning {{object backing the pointer will be destroyed at the end of the full-expression}}
0 commit comments