aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/reference.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/reference.cpp')
-rw-r--r--test/Analysis/reference.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/Analysis/reference.cpp b/test/Analysis/reference.cpp
index e46016b762..4a2cbb8e25 100644
--- a/test/Analysis/reference.cpp
+++ b/test/Analysis/reference.cpp
@@ -121,6 +121,18 @@ void testReferenceAddress(int &x) {
}
+void testFunctionPointerReturn(void *opaque) {
+ typedef int &(*RefFn)();
+
+ RefFn getRef = (RefFn)opaque;
+
+ // Don't crash writing to or reading from this reference.
+ int &x = getRef();
+ x = 42;
+ clang_analyzer_eval(x == 42); // expected-warning{{TRUE}}
+}
+
+
// ------------------------------------
// False negatives
// ------------------------------------