Commit c7c4bbfc authored by sjoblom65's avatar sjoblom65 Committed by Wouter van Oortmerssen

Error C2668: 'Service::Version2::CreateServiceValues' : ambiguous call to…

Error C2668: 'Service::Version2::CreateServiceValues' : ambiguous call to overloaded function (#4161)

* Update idl_gen_cpp.cpp

Fix for: error C2668: 'Service::Version2::CreateServiceValues' : ambiguous call to overloaded function #4145

* Update idl_gen_cpp.cpp

Also needed the same change in the getPostTable

* Add files via upload

New generation from running generate_test.bat

* Add files via upload

Lets try this without added line feeds

* Added a test for a potential "ambiguous call to overloaded function"

* Change to a better name of the table.

Didn't like the Service in the name.

* Reverted back to the original
parent d7ba17df
......@@ -1356,8 +1356,12 @@ class CppGenerator : public BaseGenerator {
}
}
// Need to call "Create" with the struct namespace.
const auto qualified_create_name = struct_def.defined_namespace->GetFullyQualifiedName("Create");
code_.SetValue("CREATE_NAME", TranslateNameSpace(qualified_create_name));
code_ += ") {";
code_ += " return Create{{STRUCT_NAME}}(";
code_ += " return {{CREATE_NAME}}{{STRUCT_NAME}}(";
code_ += " _fbb\\";
for (auto it = struct_def.fields.vec.begin();
it != struct_def.fields.vec.end(); ++it) {
......@@ -1658,8 +1662,11 @@ class CppGenerator : public BaseGenerator {
}
code_ += " auto _" + field.name + " = " + GenCreateParam(field) + ";";
}
// Need to call "Create" with the struct namespace.
const auto qualified_create_name = struct_def.defined_namespace->GetFullyQualifiedName("Create");
code_.SetValue("CREATE_NAME", TranslateNameSpace(qualified_create_name));
code_ += " return Create{{STRUCT_NAME}}(";
code_ += " return {{CREATE_NAME}}{{STRUCT_NAME}}(";
code_ += " _fbb\\";
for (auto it = struct_def.fields.vec.begin();
it != struct_def.fields.vec.end(); ++it) {
......
......@@ -439,7 +439,7 @@ inline flatbuffers::Offset<Stat> CreateStatDirect(
const char *id = nullptr,
int64_t val = 0,
uint16_t count = 0) {
return CreateStat(
return MyGame::Example::CreateStat(
_fbb,
id ? _fbb.CreateString(id) : 0,
val,
......@@ -952,7 +952,7 @@ inline flatbuffers::Offset<Monster> CreateMonsterDirect(
float testf2 = 3.0f,
float testf3 = 0.0f,
const std::vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring2 = nullptr) {
return CreateMonster(
return MyGame::Example::CreateMonster(
_fbb,
pos,
mana,
......@@ -1008,7 +1008,7 @@ inline flatbuffers::Offset<Monster> Monster::Pack(flatbuffers::FlatBufferBuilder
inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
(void)_rehasher;
(void)_o;
return CreateMonster(
return MyGame::Example2::CreateMonster(
_fbb);
}
......@@ -1036,7 +1036,7 @@ inline flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnu
(void)_rehasher;
(void)_o;
auto _color = _o->color;
return CreateTestSimpleTableWithEnum(
return MyGame::Example::CreateTestSimpleTableWithEnum(
_fbb,
_color);
}
......@@ -1065,7 +1065,7 @@ inline flatbuffers::Offset<Stat> CreateStat(flatbuffers::FlatBufferBuilder &_fbb
auto _id = _o->id.size() ? _fbb.CreateString(_o->id) : 0;
auto _val = _o->val;
auto _count = _o->count;
return CreateStat(
return MyGame::Example::CreateStat(
_fbb,
_id,
_val,
......@@ -1146,7 +1146,7 @@ inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder
auto _testf2 = _o->testf2;
auto _testf3 = _o->testf3;
auto _testarrayofstring2 = _o->testarrayofstring2.size() ? _fbb.CreateVectorOfStrings(_o->testarrayofstring2) : 0;
return CreateMonster(
return MyGame::Example::CreateMonster(
_fbb,
_pos,
_mana,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment