[clazy] [Bug 393038] New: False positive check "function-args-by-value". Template override case.

Roman bugzilla_noreply at kde.org
Thu Apr 12 11:59:19 BST 2018


https://bugs.kde.org/show_bug.cgi?id=393038

            Bug ID: 393038
           Summary: False positive check "function-args-by-value".
                    Template override case.
           Product: clazy
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: unassigned-bugs at kde.org
          Reporter: dismine at gmail.com
                CC: smartins at kde.org
  Target Milestone: ---

Hi,

Maybe this is duplicate for issue https://bugs.kde.org/show_bug.cgi?id=391812,
but because i cannot check i create new issue.

In my project i have this code:
class MyClass
{
public:
    template <typename T>
    void SetAttribute(QDomElement &domElement, const QString &name, const T
&value) const;
};

template <typename T>
inline void MyClass::SetAttribute(QDomElement &domElement, const QString &name,
const T &value) const
{
    // See specification for xs:decimal
    const QLocale locale = QLocale::c();
    domElement.setAttribute(name,
locale.toString(value).remove(locale.groupSeparator()));
}

template <>
inline void MyClass::SetAttribute<QString>(QDomElement &domElement, const
QString &name, const QString &value) const
{
    domElement.setAttribute(name, value);
}

template <>
inline void MyClass::SetAttribute<QChar>(QDomElement &domElement, const QString
&name, const QChar &value) const
{
    domElement.setAttribute(name, value);
}

template <>
inline void MyClass::SetAttribute<bool>(QDomElement &domElement, const QString
&name, const bool &value) const
{
    domElement.setAttribute(name, value ? QStringLiteral("true") :
QStringLiteral("false"));
}

Clazy correctly warns about bool and QChar arguments, but i cannot change the
function declaration, it won't compile with error "no function template matches
function template specialization 'SetAttribute'".

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Unassigned-bugs mailing list