Skip to content

Commit 6cc29c3

Browse files
fix GetScope attribute of a templated class
example: `ns::klass<t1>::attr`
1 parent 77a28e7 commit 6cc29c3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

clingwrapper/src/clingwrapper.cxx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,18 @@ Cppyy::TCppScope_t Cppyy::GetScope(const std::string& name,
789789

790790
if (Cppyy::IsTemplate(scope)) {
791791
std::vector<Cpp::TemplateArgInfo> templ_params;
792-
if (!Cppyy::AppendTypesSlow(params, templ_params))
793-
return Cpp::InstantiateTemplate(scope, templ_params.data(),
792+
if (!Cppyy::AppendTypesSlow(params, templ_params)) {
793+
scope = Cpp::InstantiateTemplate(scope, templ_params.data(),
794794
templ_params.size());
795+
if (scope) {
796+
if (size_t end = name.rfind('>'); end != std::string::npos) {
797+
std::string attribute = name.substr(end + 1);
798+
if (attribute.size() > 2) // go past ::
799+
Cppyy::GetScope(attribute.substr(2), scope);
800+
return scope;
801+
}
802+
}
803+
}
795804
}
796805
}
797806
return nullptr;

0 commit comments

Comments
 (0)