diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:06:01 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:06:01 +0000 |
| commit | 486754660bb926339aefcf012a3f848592babb8b (patch) | |
| tree | ecdbc446c9876f4f120f701c243373cd3cb43db3 /test/SemaCXX/return-stack-addr.cpp | |
| parent | 55e6d896ad333f07bb3b1ba487df214fc268a4ab (diff) | |
Notes
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(); } +} |
