A different behaviour of my matcher


I built a matcher to retrieve a copy constructor with the form:

X(const X& copy) { …}

DeclarationMatcher CC =
isCopyAssignmentOperator(), has(compoundStmt(has(stmt()))),

Everything seemed to work fine, but something strange has happened today. I was testing the matcher with a program containing the next class in the header file:

class StrPair

StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {}

void Set( char* start, char* end, int flags ) {
_start = start;
_end = end;
_flags = flags;

const char* GetStr();

bool Empty() const {
return _start == _end;

void SetInternedStr( const char* str ) {
_start = const_cast<char*>(str);

void SetStr( const char* str, int flags=0 );

char* ParseText( char* in, const char* endTag, int strFlags );
char* ParseName( char* in );

void Reset();
void CollapseWhitespace();

// After parsing, if _end != 0, it can be set to zero.
int _flags;
char* _end;

To my surprise, my matcher retrieved the name of the class:

class StrPair

This program has a .cpp file defining some of the methods of the class as well, but only the header file is changed, so I think the .cpp file is not the problem.

However, to test what was happening, I put the class in another file with some other classes and the same matcher didn’t make the change that I comment above.

What can be happening here? The class StrPair doesn’t even have a copy constructor…