[odb-users] do not use PRAGMA_DB macro if ODB is using gcc 6.x as
underlying compiler
Sten Kultakangas
ratkaisut at gmail.com
Sat Dec 24 14:27:47 EST 2016
Hello
I found a problem related to the PRAGMA_DB macro expansion in gcc 6.2.
Let's consider the following example:
PRAGMA_DB(object)
struct country
{
PRAGMA_DB(id)
std::string code_;
std::string name_;
};
PRAGMA_DB(object)
struct employee
{
PRAGMA_DB(id)
unsigned long id_;
std::string first_;
};
PRAGMA_DB(view object(employee) object(country inner: employee::first_
== country::name_))
struct employee_country_objects
{
shared_ptr<employee> e;
shared_ptr<country> res;
};
If ODB has been build to use gcc 6.2, then the above example will
produce the following error:
employee_.hxx:44:24: error: unable to find associated object for object pointer
employee_.hxx:44:24: info: use associated object alias as this data member name
When you change replace the line preceding the view definition with
the following line
#pragma db view object(employee) object(country inner:
employee::first_ == country::name_)
the above example will be compiled fine.
So if you use the -Wall option, then you'll probably want to use -Wall
-Wno-unknown-pragmas
Best regards,
Sten Kultakangas
More information about the odb-users
mailing list