[odb-users] base class, derived, separate headers and derived
references base
MM
finjulhich at gmail.com
Sun Jul 19 04:51:02 EDT 2015
yes I had done that... Thanks for adding the error in the odb compiler.
On 17 July 2015 at 11:52, Boris Kolpackov <boris at codesynthesis.com> wrote:
> Hi,
>
> MM <finjulhich at gmail.com> writes:
>
> > Looking at the the hxx, it just appears to me now the
> > composite_value_traits< ::NS::selector, id_sqlite > class is defined
> > _after_ this point (line 76). Is that why I have this error?
>
> Thanks for the test. Yes, this is the source of the problem. Composite
> values should be defined before being used. This normally gets enforced
> naturally (because you cannot use a type in a data member until it is
> defined), but in case of virtual data members, this can be subverted.
>
> I've added a check for this to the ODB compiler. Now, for your case,
> it prints:
>
> NS/A.hpp:6:8: error: composite value type ::NS::selector must be defined
> before being used in class ::NS::A
> NS_odb/A.hpp:10:12: info: data member ulid uses selector
> NS/A.hpp:10:8: info: class selector is define here
>
>
> > Is there a way to force generation of that class for selector before?
>
> No, if the two entities (object A and selector, in your case) are
> generated into the same source file, then they are generated in
> the order they are defined in C++. So the two ways to fix your
> example are: (1) move selector before A in A.hpp or (2) generate
> A and selector into different source files.
>
> I've done (1) and after fixing a couple of other bugs in your
> example, the generated code compiles fine.
>
> Boris
>
More information about the odb-users
mailing list