diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-12-04 12:20:04 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-12-04 12:20:04 +0200 |
commit | 9be991ba36305efdce2dac83eb0496fe1b9ff473 (patch) | |
tree | 4f362b98c783cb2e13e4326adf2f7fddfa21af55 | |
parent | 3417fc7c0df3b1b01750874587c4f3bb2ef02f45 (diff) |
Fix bug in wrapped type resolution
-rw-r--r-- | odb/processor.cxx | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/odb/processor.cxx b/odb/processor.cxx index 8eab2d8..89905c2 100644 --- a/odb/processor.cxx +++ b/odb/processor.cxx @@ -938,8 +938,39 @@ namespace // tree type (DECL_ORIGINAL_TYPE (decl)); - semantics::type& wt ( - dynamic_cast<semantics::type&> (*unit.find (type))); + bool qc (CP_TYPE_CONST_P (type)); + bool qv (CP_TYPE_VOLATILE_P (type)); + bool qr (CP_TYPE_RESTRICT_P (type)); + + type = TYPE_MAIN_VARIANT (type); + semantics::type* wt ( + dynamic_cast<semantics::type*> (unit.find (type))); + + // Object pointers and wrappers often use the same smart + // pointers so check if the wrapped type is an object. + // + if (object (*wt)) + { + t.set ("wrapper", false); + return false; + } + + if (qc || qv || qr) + { + for (semantics::type::qualified_iterator i (wt->qualified_begin ()); + i != wt->qualified_end (); ++i) + { + semantics::qualifier& q (i->qualifier ()); + + if (q.const_ () == qc && + q.volatile_ () == qv && + q.restrict_ () == qr) + { + wt = &q; + break; + } + } + } // Find the hint. // @@ -955,7 +986,7 @@ namespace decl = TYPE_NAME (ot); } - t.set ("wrapper-type", &wt); + t.set ("wrapper-type", wt); t.set ("wrapper-hint", wh); } catch (operation_failed const&) |