From fde4431ec608b467de6ab205e3f73848fe9efbdf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 15 Sep 2017 15:17:14 +0200 Subject: Rename variable in generated code to avoid conflict This allows "unofficial" (as in, it compiles but hasn't been reviewed or tested) use of object pointers as object ids. --- odb/relational/source.hxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/odb/relational/source.hxx b/odb/relational/source.hxx index f679366..f7ae8f3 100644 --- a/odb/relational/source.hxx +++ b/odb/relational/source.hxx @@ -2259,7 +2259,7 @@ namespace relational os << "bool is_null (ptr_traits::null_ptr (" << member << "));" << "if (!is_null)" << "{" - << "const " << type << "& id (" << endl; + << "const " << type << "& ptr_id (" << endl; if (lazy_pointer (pt)) os << "ptr_traits::object_id< ptr_traits::element_type > (" << @@ -2270,7 +2270,7 @@ namespace relational os << ");" << endl; - member = "id"; + member = "ptr_id"; } else if (comp != 0) type = mi.fq_type (); @@ -2721,9 +2721,9 @@ namespace relational os << "else" << "{"; - os << type << " id;"; + os << type << " ptr_id;"; - member = "id"; + member = "ptr_id"; } else type = mi.fq_type (); @@ -2765,7 +2765,7 @@ namespace relational if (lazy_pointer (pt)) os << member << " = ptr_traits::pointer_type (" << endl - << "*static_cast<" << db << "::database*> (db), id);"; + << "*static_cast<" << db << "::database*> (db), ptr_id);"; else { os << "// If a compiler error points to the line below, then" << endl @@ -2774,7 +2774,7 @@ namespace relational << "//" << endl << member << " = ptr_traits::pointer_type (" << endl << "static_cast<" << db << "::database*> (db)->load<" << endl - << " obj_traits::object_type > (id));"; + << " obj_traits::object_type > (ptr_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