Skip to content

fix: resolve namespace while instantiating templates in a namespace #151

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 11 additions & 1 deletion clingwrapper/src/clingwrapper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ bool split_comma_saparated_types(const std::string& name,

// returns true if no new type was added.
bool Cppyy::AppendTypesSlow(const std::string& name,
std::vector<Cpp::TemplateArgInfo>& types) {
std::vector<Cpp::TemplateArgInfo>& types, Cppyy::TCppScope_t parent) {

// Add no new type if string is empty
if (name.empty())
Expand Down Expand Up @@ -593,6 +593,16 @@ bool Cppyy::AppendTypesSlow(const std::string& name,
if (is_integral(i))
integral_value = strdup(i.c_str());
types.emplace_back(type, integral_value);
} else if (parent && (Cpp::IsNamespace(parent) || Cpp::IsClass(parent))) {
if (Cppyy::TCppType_t type = Cppyy::GetTypeFromScope(Cppyy::GetNamed(name, parent))) {
const char* integral_value = nullptr;
if (is_integral(i))
integral_value = strdup(i.c_str());
types.emplace_back(type, integral_value);
} else {
types.clear();
return true;
}
} else {
types.clear();
return true;
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 @@ -93,7 +93,7 @@ namespace Cppyy {
TCppType_t GetType(const std::string &name, bool enable_slow_lookup = false);
RPY_EXPORTED
bool AppendTypesSlow(const std::string &name,
std::vector<Cpp::TemplateArgInfo>& types);
std::vector<Cpp::TemplateArgInfo>& types, Cppyy::TCppScope_t parent = nullptr);
RPY_EXPORTED
TCppType_t GetComplexType(const std::string &element_type);
RPY_EXPORTED
Expand Down
Loading