[odb-users] Variable name conflict in generated code
Dieter Govaerts
dieter.govaerts at bricsys.com
Wed Sep 13 09:15:39 EDT 2017
Hi,
Consider following example:
#ifndef TEST_H
#define TEST_H
#include <memory>
#include <string>
#pragma db namespace() pointer(std::shared_ptr)
#pragma db object
struct Key
{
#pragma db id auto
unsigned id_;
std::string name_;
};
using KeyPtr = std::shared_ptr<Key>;
#pragma db object
struct KeyValue
{
#pragma db id not_null
KeyPtr key_;
std::string value_;
};
#endif // TEST_H
If compiled with:
odb --std c++11 --database sqlite --generate-query test.h
it produces an error in the generated code for method access::object_traits_impl< ::KeyValue, id_sqlite >::id. Two different variables are declared "id_type id" and "obj_traits::id_type id" in different scopes but are both used in a single statement.
I can fix it of course by renaming one of them but wanted to inform you to have it fixed by a next release.
Regards,
Dieter
More information about the odb-users
mailing list