summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/temporaries.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/temporaries.cpp')
-rw-r--r--clang/test/Analysis/temporaries.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/Analysis/temporaries.cpp b/clang/test/Analysis/temporaries.cpp
index ebfbfe9bee3..ddad855d338 100644
--- a/clang/test/Analysis/temporaries.cpp
+++ b/clang/test/Analysis/temporaries.cpp
@@ -141,3 +141,19 @@ namespace destructors {
}
}
}
+
+void testStaticMaterializeTemporaryExpr() {
+ static const Trivial &ref = getTrivial();
+ clang_analyzer_eval(ref.value == 42); // expected-warning{{TRUE}}
+
+ static const Trivial &directRef = Trivial(42);
+ clang_analyzer_eval(directRef.value == 42); // expected-warning{{TRUE}}
+
+#if __cplusplus >= 201103L
+ thread_local static const Trivial &threadRef = getTrivial();
+ clang_analyzer_eval(threadRef.value == 42); // expected-warning{{TRUE}}
+
+ thread_local static const Trivial &threadDirectRef = Trivial(42);
+ clang_analyzer_eval(threadDirectRef.value == 42); // expected-warning{{TRUE}}
+#endif
+}
OpenPOWER on IntegriCloud