| Summary: | [Bindings] virtual function overrider should hide the previous virtual function | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Devin Steffler <devinsteffler.lists> |
| Component: | cdt-parser | Assignee: | Nathan Ridge <zeratul976> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | eclipse.sprigogin, john.camelon, zeratul976 |
| Version: | 3.0 | ||
| Target Milestone: | 8.8.0 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| See Also: |
https://git.eclipse.org/r/52210 https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=d9a2c02fbf285a3979679a74ad3ccff0a06194d4 https://git.eclipse.org/r/52211 https://git.eclipse.org/r/52212 https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=8af3f1df866e526686a60889226d405257b55f24 https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=b82275a4c0aeb937cd4df6d1a6dc8175a9519267 |
||
| Whiteboard: | |||
Future means you commit to fix it in the Future. Inboxes can't make committments. Moving to '--'. What's happening here is that name lookup for the 'f' in 'c.f()' finds the 'f' brought into C's scope via the using-declaration, and stops there (i.e. doesn't go into BaseClassLookup). I think what's missing is a step where a virtual function found via name resoluton is replaced with its final overrider, where known. We already code that does final overrider analysis, used by codan's AbstractClassInstantiationChecker. I have a series of patches that extract the final overrider analysis code so it can be reused, and use it during name lookup to perform the replacement described above. I also cache final overrider information in the AST as it is somewhat expensive to compute. Patches: https://git.eclipse.org/r/#/c/52210/ https://git.eclipse.org/r/#/c/52211/ https://git.eclipse.org/r/#/c/52212/ Gerrit change https://git.eclipse.org/r/52210 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=d9a2c02fbf285a3979679a74ad3ccff0a06194d4 Gerrit change https://git.eclipse.org/r/52211 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=8af3f1df866e526686a60889226d405257b55f24 Gerrit change https://git.eclipse.org/r/52212 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=b82275a4c0aeb937cd4df6d1a6dc8175a9519267 Thank you, Nathan. |
This bug might be or be dependent on 86649. // example code taken from CPP spec 10.3-2: struct A { virtual void f(); // openReferences picks up 3 A::f (but one is B::f) }; struct B : virtual A { virtual void f(); // openReferences fails }; struct C : B , virtual A { using A::f; }; void foo() { C c; c.f(); //calls B::f, the final overrider // openDeclaration picks up A::f c.C::f(); //calls A::f because of the usingdeclaration }