Joseph Bonanza - 2023-06-29

Hello,

I ran into this issue with template function specialization which seems like a bug to me, but maybe I'm just missing something. I have code that looks like this:

class Checker
{
public:

    /// Fruit checking template function
    template <FruitType T>
    bool CheckFruit(int type);
};

/// @brief specialized APPLE checker
template<>
bool Checker::CheckFruit<APPLE>(int type)
{
    ...
}

/// @brief specialized ORANGE checker
template<>
bool Checker::CheckFruit<ORANGE>(int type)
{
    ...
}

I was expecting to see a <memberdef> in the output xml for each of specialization with the specialization value included in the <definition> - something like <definition>bool Checker::CheckFruit<APPLE></definition>, or that the specialization value would be included in the <templateparamlist>. </templateparamlist></definition></memberdef>

Instead, the output does contain a separate entry for each specialization, but the <definition>s are identical (except for the @brief comments), and don't include the specialization value; and the <templateparamlist>s are empty:</templateparamlist></definition>

      <memberdef kind="function" id="classChecker_1a6c65ebe1921e7a9445c4f21fd55679f5" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <templateparamlist>
        </templateparamlist>
        <type>bool</type>
        <definition>bool Checker::CheckFruit</definition>
        <argsstring>(int type)</argsstring>
        <name>CheckFruit</name>
        <qualifiedname>Checker::CheckFruit</qualifiedname>
        <param>
          <type>int</type>
          <declname>type</declname>
        </param>
        <briefdescription>
<para>specialized APPLE checker </para>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="Checker.cpp" line="6" column="1" bodyfile="Checker.cpp" bodystart="6" bodyend="12"/>
      </memberdef>
      <memberdef kind="function" id="classChecker_1a6c65ebe1921e7a9445c4f21fd55679f5" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <templateparamlist>
        </templateparamlist>
        <type>bool</type>
        <definition>bool Checker::CheckFruit</definition>
        <argsstring>(int type)</argsstring>
        <name>CheckFruit</name>
        <qualifiedname>Checker::CheckFruit</qualifiedname>
        <param>
          <type>int</type>
          <declname>type</declname>
        </param>
        <briefdescription>
<para>specialized ORANGE checker </para>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="Checker.cpp" line="16" column="1" bodyfile="Checker.cpp" bodystart="16" bodyend="22"/>
      </memberdef>

Is there a way to get the specialization value to show in the xml?

Thanks,
Joey