aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorColin Snover2017-10-06 21:05:38 -0500
committerColin Snover2017-10-06 22:10:50 -0500
commitf037d4df1680aecefac2ffb240547385a74971d0 (patch)
treec9c5195328bae7ff7bc59b8c0adbbf2e6e3d717e /test
parent79dd02373cb431adfceeb4be50366b7c084490d9 (diff)
downloadscummvm-rg350-f037d4df1680aecefac2ffb240547385a74971d0.tar.gz
scummvm-rg350-f037d4df1680aecefac2ffb240547385a74971d0.tar.bz2
scummvm-rg350-f037d4df1680aecefac2ffb240547385a74971d0.zip
COMMON: Allow construction of Arrays of non-copyable members
Although the previous count-constructor would never make a copy of a member at runtime, Array<T>::reserve *may* copy-construct, so the compiler would forbid creation of arrays of NonCopyable objects even when the array was created only once and then never resized (and thus never actually tried to perform a copy-construction).
Diffstat (limited to 'test')
-rw-r--r--test/common/array.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/common/array.h b/test/common/array.h
index 45be99371f..e0a6438d52 100644
--- a/test/common/array.h
+++ b/test/common/array.h
@@ -1,6 +1,7 @@
#include <cxxtest/TestSuite.h>
#include "common/array.h"
+#include "common/noncopyable.h"
#include "common/str.h"
class ArrayTestSuite : public CxxTest::TestSuite
@@ -315,6 +316,10 @@ class ArrayTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS(array.size(), 10U);
TS_ASSERT_EQUALS(array[0], 0);
TS_ASSERT_EQUALS(array[9], 0);
+
+ // This will fail at compile time if it is not possible to construct an
+ // array without copy-construction
+ Common::Array<Common::NonCopyable> nonCopyable(1);
}
void test_array_constructor_count_copy_value() {