summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb-tests/common/view/olv/driver.cxx10
-rw-r--r--odb-tests/common/view/olv/test4.hxx23
2 files changed, 24 insertions, 9 deletions
diff --git a/odb-tests/common/view/olv/driver.cxx b/odb-tests/common/view/olv/driver.cxx
index c08015e..77cf76e 100644
--- a/odb-tests/common/view/olv/driver.cxx
+++ b/odb-tests/common/view/olv/driver.cxx
@@ -367,15 +367,7 @@ main (int argc, char* argv[])
transaction t (db->begin ());
session s;
view2 v (db->query_value<view2> ());
-
- // @@ BUILD2 As of cl 19.29.30136 (VS 2019 16.11.5) v.o2.o1 points to
- // the address of o1 member of the object being returned by
- // query_value<view2>() which v is a copy of, and thus the
- // original assertion fails. Note that changing `view2 v` to
- // `const view2& v` doesn't help.
- //
- //assert (v.o1.n == 123 && v.o2.s == "abc" && v.o2.o1 == &v.o1);
- assert (v.o1.n == 123 && v.o2.s == "abc");
+ assert (v.o1.n == 123 && v.o2.s == "abc" && v.o2.o1 == &v.o1);
t.commit ();
}
diff --git a/odb-tests/common/view/olv/test4.hxx b/odb-tests/common/view/olv/test4.hxx
index f2af5fd..4d8b804 100644
--- a/odb-tests/common/view/olv/test4.hxx
+++ b/odb-tests/common/view/olv/test4.hxx
@@ -6,6 +6,7 @@
#include <string>
#include <memory> // shared_ptr
+#include <cassert>
#include <odb/core.hxx>
@@ -90,6 +91,17 @@ namespace test4
object1 o1;
object2 o2;
+
+ view2 () {}
+ view2 (const view2& v)
+ : o1 (v.o1), o2 (v.o2)
+ {
+ if (v.o2.o1 != 0)
+ {
+ assert (v.o2.o1 == &v.o1);
+ o2.o1 = &o1;
+ }
+ }
};
#pragma db view object(object1) object(object2) transient
@@ -102,6 +114,17 @@ namespace test4
object1 o1;
object2 o2;
bool o2_null;
+
+ view2a () {}
+ view2a (const view2a& v)
+ : o1 (v.o1), o2 (v.o2)
+ {
+ if (v.o2.o1 != 0)
+ {
+ assert (v.o2.o1 == &v.o1);
+ o2.o1 = &o1;
+ }
+ }
};
// Test loading into raw pointer with non-raw object pointer.