summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/array-struct-region.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/array-struct-region.cpp')
-rw-r--r--clang/test/Analysis/array-struct-region.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/Analysis/array-struct-region.cpp b/clang/test/Analysis/array-struct-region.cpp
index 12ae5d3eba6..a776d7da50b 100644
--- a/clang/test/Analysis/array-struct-region.cpp
+++ b/clang/test/Analysis/array-struct-region.cpp
@@ -173,4 +173,27 @@ void testImmediateUseOp() {
clang_analyzer_eval(getConstrainedFieldRefOp(getS()) == 42); // expected-warning{{TRUE}}
}
+namespace EmptyClass {
+ struct Base {
+ int& x;
+
+ Base(int& x) : x(x) {}
+ };
+
+ struct Derived : public Base {
+ Derived(int& x) : Base(x) {}
+
+ void operator=(int a) { x = a; }
+ };
+
+ Derived ref(int& a) { return Derived(a); }
+
+ // There used to be a warning here, because analyzer treated Derived as empty.
+ int test() {
+ int a;
+ ref(a) = 42;
+ return a; // no warning
+ }
+}
+
#endif
OpenPOWER on IntegriCloud