[odb-users] odb compiler assert when db value pragma placed on subclass

Boris Kolpackov boris at codesynthesis.com
Mon Oct 8 08:56:16 EDT 2012

Hi Sean,

Stroud, Sean T <ststrou at sandia.gov> writes:

> I get an assert from odb on the following program:
> class Bar
> {
> };
> #pragma db value
> class Foo : public Bar
> {
>   public:
>     int m_seconds;
> };

You've uncovered another corner case bug, thanks! It is now fixed and I
can build you a binary if you would like.

> However, I was wondering what odb will do once this bug is fixed. Will
> the odb compiler support this kind of situation (i.e. db value pragma
> on a subclass)?

ODB treats this as "transient inheritance". That is, whatever data members
are defined in Bar, they will be ignored for database persistence purposes.
On the other hand, if you want Bar's state to be saved in the database,
then you will need to make it a composite value as well.

Both of the above cases support multiple inheritance.


More information about the odb-users mailing list