mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Have to use cast to solve ambiguity... =/
This commit is contained in:
parent
cb492e7c29
commit
4d629e6c73
@ -245,6 +245,11 @@ TEST_CASE("tables/operator[]", "Check if operator[] retrieval and setting works
|
|||||||
lua.script("foo = 20\nbar = \"hello world\"");
|
lua.script("foo = 20\nbar = \"hello world\"");
|
||||||
// basic retrieval
|
// basic retrieval
|
||||||
std::string bar = lua["bar"];
|
std::string bar = lua["bar"];
|
||||||
|
REQUIRE(bar == "hello world");
|
||||||
|
// Ambiguity case on operator= for compilation testing
|
||||||
|
// Have to use cast, there's no other way...
|
||||||
|
bar = (std::string)lua["bar"];
|
||||||
|
REQUIRE(bar == "hello world");
|
||||||
int foo = lua["foo"];
|
int foo = lua["foo"];
|
||||||
REQUIRE(bar == "hello world");
|
REQUIRE(bar == "hello world");
|
||||||
REQUIRE(foo == 20);
|
REQUIRE(foo == 20);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user