[odb-users] Name clash when using nested value types with pointer

Marcel Nehring mne at qosmotec.com
Mon Jul 20 12:39:18 EDT 2015


Hi Boris,

I discovered an issue with the ODB compiler today. A short, self-contained, compilable, example is attached below.

When nesting value objects where one of the inner objects has a pointer to some other object, the ODB compiler creates nested structs and names these structs according to the names of the corresponding member variables. If the names happen to be identical this leads to a compile error.

In case you find time to fix the problem it would be nice if you could again provide a pre-release binary package including the fix.

Thanks & best regards,
                Marcel

#include <memory>

#pragma db object
class Object
{
public:
    #pragma db id
    int id;
};

#pragma db value
class Value
{
public:
    std::shared_ptr<Object> m_object;
};

#pragma db value
class Bar
{
public:
    Value m_value;

};

#pragma db object
class Foo
{
public:
    Bar m_value;

    #pragma db id
    int id;
};


More information about the odb-users mailing list