summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2014-11-27 01:29:32 +0000
committerRichard Trieu <rtrieu@google.com>2014-11-27 01:29:32 +0000
commitc321b931c01537e254d9f89746cc124f55b4b6aa (patch)
tree9b7e34f46fe687ab2699d9e67a9cdd8030b77dfa /clang/test/SemaCXX
parente13d71c57ca5656e16ad2f1e5b18949289b3f84e (diff)
downloadbcm5719-llvm-c321b931c01537e254d9f89746cc124f55b4b6aa.tar.gz
bcm5719-llvm-c321b931c01537e254d9f89746cc124f55b4b6aa.zip
When checking for uninitialized values, do not confuse "std::move" with every
other function named "move". llvm-svn: 222863
Diffstat (limited to 'clang/test/SemaCXX')
-rw-r--r--clang/test/SemaCXX/uninitialized.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/uninitialized.cpp b/clang/test/SemaCXX/uninitialized.cpp
index ac08183a70c..018b1feba96 100644
--- a/clang/test/SemaCXX/uninitialized.cpp
+++ b/clang/test/SemaCXX/uninitialized.cpp
@@ -1341,3 +1341,47 @@ struct D : public C, public A {
};
}
+
+namespace value {
+template <class T> T move(T t);
+template <class T> T notmove(T t);
+}
+namespace lvalueref {
+template <class T> T move(T& t);
+template <class T> T notmove(T& t);
+}
+namespace rvalueref {
+template <class T> T move(T&& t);
+template <class T> T notmove(T&& t);
+}
+
+namespace move_test {
+int a1 = std::move(a1); // expected-warning {{uninitialized}}
+int a2 = value::move(a2); // expected-warning {{uninitialized}}
+int a3 = value::notmove(a3); // expected-warning {{uninitialized}}
+int a4 = lvalueref::move(a4);
+int a5 = lvalueref::notmove(a5);
+int a6 = rvalueref::move(a6);
+int a7 = rvalueref::notmove(a7);
+
+void test() {
+ int a1 = std::move(a1); // expected-warning {{uninitialized}}
+ int a2 = value::move(a2); // expected-warning {{uninitialized}}
+ int a3 = value::notmove(a3); // expected-warning {{uninitialized}}
+ int a4 = lvalueref::move(a4);
+ int a5 = lvalueref::notmove(a5);
+ int a6 = rvalueref::move(a6);
+ int a7 = rvalueref::notmove(a7);
+}
+
+class A {
+ int a;
+ A(int (*) [1]) : a(std::move(a)) {} // expected-warning {{uninitialized}}
+ A(int (*) [2]) : a(value::move(a)) {} // expected-warning {{uninitialized}}
+ A(int (*) [3]) : a(value::notmove(a)) {} // expected-warning {{uninitialized}}
+ A(int (*) [4]) : a(lvalueref::move(a)) {}
+ A(int (*) [5]) : a(lvalueref::notmove(a)) {}
+ A(int (*) [6]) : a(rvalueref::move(a)) {}
+ A(int (*) [7]) : a(rvalueref::notmove(a)) {}
+};
+}
OpenPOWER on IntegriCloud