You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Template Parameters on Functions with a Templated Namespace are not gathered #5
When defining a template parameter on a function, if the function is in the namespace of a templatable class, the template parameter of the function is not gathered.
template <typename T>
T cls::foo() {}
template <typename R>
R cls<R>::bar() {}
When nameCollector is run on the above code, the output is:
The following 3 user defined identifiers occur:
T is a template-parameter in file: nc_test.cpp at 1:20
foo is a T function in file: nc_test.cpp at 2:8
bar is a R function in file: nc_test.cpp at 5:11
There should be a 4th line, stating:
R is a template-parameter in file: nc_test.cpp at 4:20
Bug seems to have been introduced from the fix for Issue 3. Previously, functions like ns::foo() would have duplicated entries, one for ns and one for foo. However, functions like cls<T>::foo() would NOT have the duplication, and the fix is not needed in this case.
Template parameter for both cases is now being collected.
template <typename T>
T cls::foo() {}
template <classR>
R cls<R>::bar() {}
is now being collected correctly with both template parameters being collected:
"T is a template-parameter in C++ file: test_template_parameter.cpp:3:20foo is a T function in C++ file: test_template_parameter.cpp:4:8R is a template-parameter in C++ file: test_template_parameter.cpp:5:17bar is a R function in C++ file: test_template_parameter.cpp:6:11"
Activity
jmaletic commentedon May 22, 2024
It is also missing the local variables in the methods defined outside the class.
bool stack::isEmpty() const { int temp = 5; }
temp is not showing up.
Joshua2000B commentedon May 22, 2024
Bug seems to have been introduced from the fix for Issue 3. Previously, functions like
ns::foo()would have duplicated entries, one fornsand one forfoo. However, functions likecls<T>::foo()would NOT have the duplication, and the fix is not needed in this case.jmaletic commentedon May 22, 2024
If we had a testsuite and did regression testing it would have been found immediately
sophia-gh commentedon Sep 12, 2025
Template parameter for both cases is now being collected.
is now being collected correctly with both template parameters being collected: