From 938d136b09b868f633574c722d48c2953dde1be4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 29 Oct 2012 10:02:16 +0200 Subject: Cast odb::database to concrete type when initializing object pointer --- odb/relational/source.hxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'odb/relational/source.hxx') diff --git a/odb/relational/source.hxx b/odb/relational/source.hxx index a284676..8d57b1b 100644 --- a/odb/relational/source.hxx +++ b/odb/relational/source.hxx @@ -1666,7 +1666,8 @@ namespace relational semantics::type& pt (member_utype (mi.m, key_prefix_)); if (lazy_pointer (pt)) - os << member << " = ptr_traits::pointer_type (*db, id);"; + os << member << " = ptr_traits::pointer_type (" << endl + << "*static_cast<" << db << "::database*> (db), id);"; else { os << "// If a compiler error points to the line below, then" << endl @@ -1674,7 +1675,8 @@ namespace relational << "// cannot be initialized from an object pointer." << endl << "//" << endl << member << " = ptr_traits::pointer_type (" << endl - << "db->load< obj_traits::object_type > (id));"; + << "static_cast<" << db << "::database*> (db)->load<" << endl + << " obj_traits::object_type > (id));"; // If we are loading into an eager weak pointer, make sure there // is someone else holding a strong pointer to it (normally a -- cgit v1.1