diff options
Diffstat (limited to 'test/SemaCXX/return-stack-addr.cpp')
-rw-r--r-- | test/SemaCXX/return-stack-addr.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test/SemaCXX/return-stack-addr.cpp b/test/SemaCXX/return-stack-addr.cpp index 7670798ecb9c..08aaa749b4e3 100644 --- a/test/SemaCXX/return-stack-addr.cpp +++ b/test/SemaCXX/return-stack-addr.cpp @@ -63,7 +63,8 @@ int& ret_local_field_ref() { int* ret_conditional(bool cond) { int x = 1; int y = 2; - return cond ? &x : &y; // expected-warning {{address of stack memory}} + return cond ? &x // expected-warning {{address of stack memory associated with local variable 'x' returned}} + : &y; // expected-warning {{address of stack memory associated with local variable 'y' returned}} } int* ret_conditional_rhs(int *x, bool cond) { @@ -156,3 +157,9 @@ void ret_from_lambda() { (void) [&]() -> int& { int &a = b; return a; }; (void) [=]() mutable -> int& { int &a = b; return a; }; } + +namespace mem_ptr { + struct X {}; + int X::*f(); + int &r(X *p) { return p->*f(); } +} |