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
I'm trying to use standardese with a complex C++14 codebase. One file gives the following warning: [standardese linker] [warning] MyNamespace::Constants>::PI: duplicate registration of link name 'MyNamespace::Constants>::PI'
The respective code looks like this:
namespaceMyNamespace
{
/** * \brief A class that holds mathematical constants.*/template<classT>
classConstants
{
};
/** * \brief A class that holds mathematical constants as float.*/template<>
classConstants<float>
{
public:staticconstexprfloat PI = 3.14159265F; //< Ratio of a circle's circumference to its diameter.//...
};
/** * \brief A class that holds mathematical constants as double.*/template<>
classConstants<double>
{
public:staticconstexprdouble PI = 3.1415926535897932; //< Ratio of a circle's circumference to its diameter.//...
};
}
I took some time debugging this issue. The best I came up with is that the method get_template_parameters in comment.cpp doesn't seem to handle this situation properly. For template classes it adds the template parameters within angular brackets, but for template specializations, it just appends a opening angular bracket, then replaces this with a closing angular bracket.
I'm not quite sure about the correct solution to this problem, otherwise I would have written a PR. My best guess is, that I would have to cast the entity to cppast::cpp_class_template_specialization and then add the unexposed arguments into angular brackets. But, would I need to do some further formatting on the list of unexposed arguments or could I just put them there literally?
Thanks for your help,
René
The text was updated successfully, but these errors were encountered:
Reen
changed the title
Template Specialization lead to Warning "duplicate registration of link name"
Template Specialization leads to Warning "duplicate registration of link name"
Jan 17, 2023
Hi,
I'm trying to use standardese with a complex C++14 codebase. One file gives the following warning:
[standardese linker] [warning] MyNamespace::Constants>::PI: duplicate registration of link name 'MyNamespace::Constants>::PI'
The respective code looks like this:
I took some time debugging this issue. The best I came up with is that the method
get_template_parameters
incomment.cpp
doesn't seem to handle this situation properly. For template classes it adds the template parameters within angular brackets, but for template specializations, it just appends a opening angular bracket, then replaces this with a closing angular bracket.I'm not quite sure about the correct solution to this problem, otherwise I would have written a PR. My best guess is, that I would have to cast the entity to
cppast::cpp_class_template_specialization
and then add the unexposed arguments into angular brackets. But, would I need to do some further formatting on the list of unexposed arguments or could I just put them there literally?Thanks for your help,
René
The text was updated successfully, but these errors were encountered: