-
Notifications
You must be signed in to change notification settings - Fork 31
[MRE] successive Declare fails if InstantiateFunctionDefinition fails in MakeFunctionCallable #616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
57ea015
01a9c67
5103dca
16ae2e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2133,3 +2133,38 @@ TEST(FunctionReflectionTest, UndoTest) { | |
#endif | ||
#endif | ||
} | ||
|
||
TEST(FunctionReflectionTest, FailingTest1) { | ||
#ifdef _WIN32 | ||
GTEST_SKIP() << "Disabled on Windows. Needs fixing."; | ||
#endif | ||
#ifdef EMSCRIPTEN | ||
GTEST_SKIP() << "Test fails for Emscipten builds"; | ||
#endif | ||
Cpp::CreateInterpreter(); | ||
EXPECT_FALSE(Cpp::Declare(R"( | ||
class WithOutEqualOp1 {}; | ||
class WithOutEqualOp2 {}; | ||
|
||
WithOutEqualOp1 o1; | ||
WithOutEqualOp2 o2; | ||
|
||
template<class C1, class C2> | ||
bool is_equal(const C1& c1, const C2& c2) { return (bool)(c1 == c2); } | ||
)")); | ||
|
||
Cpp::TCppType_t o1 = Cpp::GetTypeFromScope(Cpp::GetNamed("o1")); | ||
Cpp::TCppType_t o2 = Cpp::GetTypeFromScope(Cpp::GetNamed("o2")); | ||
std::vector<Cpp::TCppFunction_t> fns; | ||
Cpp::GetClassTemplatedMethods("is_equal", Cpp::GetGlobalScope(), fns); | ||
EXPECT_EQ(fns.size(), 1); | ||
|
||
Cpp::TemplateArgInfo args[2] = {{o1}, {o2}}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays] Cpp::TemplateArgInfo args[2] = {{o1}, {o2}};
^ |
||
Cpp::TCppScope_t fn = Cpp::InstantiateTemplate(fns[0], args, 2); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay] Cpp::TCppScope_t fn = Cpp::InstantiateTemplate(fns[0], args, 2);
^ |
||
EXPECT_TRUE(fn); | ||
|
||
Cpp::JitCall jit_call = Cpp::MakeFunctionCallable(fn); | ||
EXPECT_EQ(jit_call.getKind(), Cpp::JitCall::kUnknown); // expected to fail | ||
EXPECT_FALSE(Cpp::Declare("int x = 1;")); | ||
EXPECT_FALSE(Cpp::Declare("int y = x;")); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: class 'PushTransactionRAII' defines a non-default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions]