diff options
Diffstat (limited to 'test/SemaCXX/return-stack-addr.cpp')
-rw-r--r-- | test/SemaCXX/return-stack-addr.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/SemaCXX/return-stack-addr.cpp b/test/SemaCXX/return-stack-addr.cpp index ba64765603607..7d4cb964029bc 100644 --- a/test/SemaCXX/return-stack-addr.cpp +++ b/test/SemaCXX/return-stack-addr.cpp @@ -108,5 +108,16 @@ int* ret_cpp_const_cast(const int x) { return const_cast<int*>(&x); // expected-warning {{address of stack memory}} } +// PR 7999 - handle the case where a field is itself a reference. +template <typename T> struct PR7999 { + PR7999(T& t) : value(t) {} + T& value; +}; + +struct PR7999_X {}; + +PR7999_X& PR7999_f(PR7999<PR7999_X> s) { return s.value; } // no-warning +void test_PR7999(PR7999_X& x) { (void)PR7999_f(x); } // no-warning + // TODO: test case for dynamic_cast. clang does not yet have // support for C++ classes to write such a test case. |