forked from luabind/luabind
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #25: Overload candidates overflow.
This was actually two bugs: First, the one mentioned in #25: invoke_normal() happily writes at array indices which do not exist. Fixed by changing the array to std::vector. Required ensuring proper destruction of invoke_context in case of lua_error. Second, given enough candidates, the default Lua stack size of 20 elements would not be enough to hold the error message parts before concatenation. Fixed by concatenating after each candidate.
- Loading branch information
Showing
5 changed files
with
76 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright Christian Neumüller 2015. Use, modification and distribution is | ||
// subject to the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#include "test.hpp" | ||
#include <luabind/function.hpp> | ||
|
||
namespace { | ||
|
||
void f() { } | ||
|
||
} // namespace unnamed | ||
|
||
void test_main(lua_State* L) | ||
{ | ||
using namespace luabind; | ||
|
||
module(L) | ||
[ // 11 functions | ||
def("f", &f), // 1 | ||
def("f", &f), // 2 | ||
def("f", &f), // 3 | ||
def("f", &f), // 4 | ||
def("f", &f), // 5 | ||
def("f", &f), // 6 | ||
def("f", &f), // 7 | ||
def("f", &f), // 8 | ||
def("f", &f), // 9 | ||
def("f", &f), // 10 | ||
def("f", &f) // 11 | ||
]; | ||
|
||
DOSTRING_EXPECTED(L, "f()", | ||
"Ambiguous, candidates:\n" // 11 candidates | ||
"void f()\n" // 1 | ||
"void f()\n" // 2 | ||
"void f()\n" // 3 | ||
"void f()\n" // 4 | ||
"void f()\n" // 5 | ||
"void f()\n" // 6 | ||
"void f()\n" // 7 | ||
"void f()\n" // 8 | ||
"void f()\n" // 9 | ||
"void f()\n" // 10 | ||
"void f()"); // 11 | ||
} |