Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/notnull_tests.cpp')
-rw-r--r--tests/notnull_tests.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/notnull_tests.cpp b/tests/notnull_tests.cpp
index a7ef27e..fa99bb7 100644
--- a/tests/notnull_tests.cpp
+++ b/tests/notnull_tests.cpp
@@ -178,10 +178,10 @@ TEST_CASE("TestNotNullCasting")
MyBase base;
MyDerived derived;
Unrelated unrelated;
- not_null<Unrelated*> u = &unrelated;
+ not_null<Unrelated*> u{&unrelated};
(void) u;
- not_null<MyDerived*> p = &derived;
- not_null<MyBase*> q = &base;
+ not_null<MyDerived*> p{&derived};
+ not_null<MyBase*> q(&base);
q = p; // allowed with heterogeneous copy ctor
CHECK(q == p);
@@ -192,18 +192,18 @@ TEST_CASE("TestNotNullCasting")
not_null<Unrelated*> r = p;
not_null<Unrelated*> s = reinterpret_cast<Unrelated*>(p);
#endif
- not_null<Unrelated*> t = reinterpret_cast<Unrelated*>(p.get());
+ not_null<Unrelated*> t(reinterpret_cast<Unrelated*>(p.get()));
CHECK(reinterpret_cast<void*>(p.get()) == reinterpret_cast<void*>(t.get()));
}
TEST_CASE("TestNotNullAssignment")
{
int i = 12;
- not_null<int*> p = &i;
+ not_null<int*> p(&i);
CHECK(helper(p));
int* q = nullptr;
- CHECK_THROWS_AS(p = q, fail_fast);
+ CHECK_THROWS_AS(p = not_null<int*>(q), fail_fast);
}
TEST_CASE("TestNotNullRawPointerComparison")