markAliasDeprecated: Fix MSVC build
authorSmallJoker <mk939@ymail.com>
Tue, 11 Sep 2018 17:32:10 +0000 (19:32 +0200)
committerSmallJoker <mk939@ymail.com>
Tue, 11 Sep 2018 17:32:10 +0000 (19:32 +0200)
src/script/lua_api/l_base.cpp

index 784b197e150c896706bbbdad4c652092cd9d1e4e..8486fc7bc5d64cd7d1acdd61aec86f7fa2feddd2 100644 (file)
@@ -151,11 +151,12 @@ void ModApiBase::markAliasDeprecated(luaL_Reg *reg)
        while (reg->func) {
                if (last_func == reg->func) {
                        // Duplicate found
-                       std::pair<std::string, luaL_Reg> entry(
-                               reg->name,
-                               { .name = last_name, .func = reg->func }
-                       );
-                       m_deprecated_wrappers.emplace(entry);
+                       luaL_Reg original_reg;
+                       // Do not inline struct. Breaks MSVC or is error-prone
+                       original_reg.name = last_name;
+                       original_reg.func = reg->func;
+                       m_deprecated_wrappers.emplace(
+                               std::pair<std::string, luaL_Reg>(reg->name, original_reg));
                        reg->func = l_deprecated_function;
                }