KWStyle icon indicating copy to clipboard operation
KWStyle copied to clipboard

Forward declaration of function masks errors in class

Open msmolens opened this issue 7 years ago • 4 comments

With KWStyle.xml:

<?xml version="1.0" encoding="iso-8859-1"?>
<Description>
<InternalVariables>m_[A-Z],0,1</InternalVariables>
</Description>

and Test.h:

#ifndef Test_h
#define Test_h

// Forward declaration
bool runTest();

class Test
{
public:
    Test() {}

protected:
    bool result;
};

#endif

KWStyle fails to show the error in the name of the member variable.

Without the forward declaration the error is detected correctly:

$ KWStyle -xml KWStyle.xml -v Test.h -gcc
Test.h:0: error: Internal variable (result) doesn't match regular expression (m_[A-Z])

The forward declaration shouldn't mask errors in the class below.

Tested with https://github.com/Kitware/KWStyle/commit/e03980ff514d5248a9f95ea355dcd9eff78c62d3.

msmolens avatar May 18 '17 14:05 msmolens