summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-01-02 19:04:59 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-01-02 19:04:59 +0000
commitc265f066971a3df6b0ec546311e63a3efe812e40 (patch)
treec96547b47041f981680fa421e595a7fc86afc173 /unittests
parentf828e82891fe49152f24b7a6cb8145a07271f573 (diff)
downloadllvm-c265f066971a3df6b0ec546311e63a3efe812e40.tar.gz
llvm-c265f066971a3df6b0ec546311e63a3efe812e40.tar.bz2
llvm-c265f066971a3df6b0ec546311e63a3efe812e40.tar.xz
Make llvm::Regex non-copyable but movable.
Based on a patch by Maciej Piechotka. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198334 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Support/RegexTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/unittests/Support/RegexTest.cpp b/unittests/Support/RegexTest.cpp
index 30ea2c5b27..c3a8085acc 100644
--- a/unittests/Support/RegexTest.cpp
+++ b/unittests/Support/RegexTest.cpp
@@ -140,4 +140,19 @@ TEST_F(RegexTest, IsValid) {
EXPECT_EQ("invalid character range", Error);
}
+#if LLVM_HAS_RVALUE_REFERENCES
+TEST_F(RegexTest, MoveConstruct) {
+ Regex r1("^[0-9]+$");
+ Regex r2(std::move(r1));
+ EXPECT_TRUE(r2.match("916"));
+}
+
+TEST_F(RegexTest, MoveAssign) {
+ Regex r1("^[0-9]+$");
+ Regex r2("abc");
+ r2 = std::move(r1);
+ EXPECT_TRUE(r2.match("916"));
+}
+#endif
+
}