Skip to content
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

fix: name conflict and GetGlobalOperator #109

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clingwrapper/src/clingwrapper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ bool Cppyy::AppendTypesSlow(const std::string &name,
if (!struct_count)
Cpp::Declare(code.c_str()); // initialize the trampoline

std::string var = "__s" + std::to_string(struct_count++);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__s8 conflicts with some variable/type name.

std::string var = "__Cppyy_s" + std::to_string(struct_count++);
// FIXME: We cannot use silent because it erases our error code from Declare!
if (!Cpp::Declare(("__Cppyy_AppendTypesSlow<" + name + "> " + var +";\n").c_str(), /*silent=*/false)) {
TCppType_t varN = Cpp::GetVariableType(Cpp::GetNamed(var.c_str()));
Expand Down
2 changes: 1 addition & 1 deletion clingwrapper/src/cpp_cppyy.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ namespace Cppyy {

RPY_EXPORTED
TCppIndex_t GetGlobalOperator(
TCppType_t scope, const std::string& lc, const std::string& rc, const std::string& op) { assert(0 && "GetGlobalOperator");return 0; }
TCppType_t scope, const std::string& lc, const std::string& rc, const std::string& op) { assert(0 && "GetGlobalOperator");return -1; }
Comment on lines 313 to +314
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetGlobalOperator is called by BuildOperator at https://github.com/Vipul-Cariappa/CPyCppyy-compiler-research/blob/b59c6b1846b40ba99fc2c5d82cbbfd90401d1667/src/Utility.cxx#L271-L274.

I believe it should be -1 and not 0. By looking at the logic at caller end.


// method properties ---------------------------------------------------------
RPY_EXPORTED
Expand Down
Loading