Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 86654 - [Bindings] virtual function overrider should hide the previous virtual function
Summary: [Bindings] virtual function overrider should hide the previous virtual function
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 8.8.0   Edit
Assignee: Nathan Ridge CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-25 11:36 EST by Devin Steffler CLA
Modified: 2015-07-25 16:51 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Steffler CLA 2005-02-25 11:36:29 EST
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
}
Comment 1 Doug Schaefer CLA 2007-08-21 10:58:00 EDT
Future means you commit to fix it in the Future. Inboxes can't make committments. Moving to '--'.
Comment 2 Nathan Ridge CLA 2015-07-19 02:26:59 EDT
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.
Comment 7 Sergey Prigogin CLA 2015-07-25 16:51:52 EDT
Thank you, Nathan.