summaryrefslogtreecommitdiff
path: root/test/Analysis
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2017-10-24 00:13:18 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2017-10-24 00:13:18 +0000
commit68518a40c274d4ee6ecad035363ac6a1040b617f (patch)
tree5a37a10e81dd376ec2fdf41868aa8c7df10bb0a3 /test/Analysis
parent2b1d1f02e9ceb837f16cf85447f8211f331954b1 (diff)
[Analyzer] Handle implicit function reference in bodyfarming std::call_once
Differential Revision: https://reviews.llvm.org/D39201 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316402 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/call_once.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/Analysis/call_once.cpp b/test/Analysis/call_once.cpp
index db701457f6..2154be6f48 100644
--- a/test/Analysis/call_once.cpp
+++ b/test/Analysis/call_once.cpp
@@ -290,3 +290,16 @@ void test_mutator_noref() {
std::call_once(flag, &fail_mutator, a);
clang_analyzer_eval(a == 42); // expected-warning{{FALSE}}
}
+
+// Function is implicitly treated as a function pointer
+// even when an ampersand is not explicitly set.
+void callbackn(int &param) {
+ param = 42;
+};
+void test_implicit_funcptr() {
+ int x = 0;
+ static std::once_flag flagn;
+
+ std::call_once(flagn, callbackn, x);
+ clang_analyzer_eval(x == 42); // expected-warning{{TRUE}}
+}