Andersbakken / rtags

A client/server indexer for c/c++/objc[++] with integration for Emacs based on clang.
http://www.rtags.net
GNU General Public License v3.0
1.83k stars 254 forks source link

reference not found to new Child constructor call when result assigned to Parent pointer #1385

Open Jacob-Burckhardt opened 4 years ago

Jacob-Burckhardt commented 4 years ago

When I ask rtags to find references to Child, it fails to find the reference on line 9:

class Parent {
};

class Child : public Parent {
   public: Child() {}
};

int main() {
   Parent *p = new Child{}; // line 9
}

To Reproduce

This command refers to the text "class Child":

/home/bjacob/no_backup/rtags/bin/rc --current-file=/home/bjacob/rtags_test/joe.C -z -t128 -r /home/bjacob/rtags_test/joe.C:4:8:

Actual output:

No output.

Expected output:

joe.C:9:20:    Parent *p = new Child{}; // line 9

If the Child constructor declaration is commented as shown below, then it gives the expected output, but of course, that workaround is impractical in most cases.

class Parent {
};

class Child : public Parent {
   //public: Child() {}
};

int main() {
   Parent *p = new Child{}; // line 9
}

Environment (please complete the following information):