Community
Participate
Working Groups
Build Identifier: M20100909-0800 If a class template B is derived from another class template A using its own template parameters, content assist does not display any of class A's member functions and variables when used within the derived class B. eg. template<typename T> class B : public class A<T> { ..broken content assist in here.. } Reproducible: Always Steps to Reproduce: It can be reproduced with this code: template<class T> class BaseClass { public: void BaseMethod() { } }; template<class T> class DerivedClass : public BaseClass<T> { public: void DerivedMethod() { this->BaseMethod(); } }; If DerivedClass is instead derived from hard-coded BaseClass<int32_t>, instead of BaseClass<T>, content-assist will work.
The base class in the example (BaseClass<T>) is a deferred class instance (a special case of a dependent name). You are asking for proposing the members of a deferred class instance. The deferred instance will not be resolved until the referring template (DerivedClass) is instantiated. So at the point where the deferred class instance is used in the source code, it is not known which template (i.e. which specialization) will be selected for its instantiation. In fact, it does not even have to be defined at the point where the reference is made. Nevertheless, for content assist it does make sense to propose the members of the primary template (ignoring potential specializations) in case it is already defined. This would cover your use-case.
Created attachment 184338 [details] testcase + fix Implements the fallback to the primary template when the base class is a deferred instance.
Fixed in 8.0 > 20101202.
*** cdt cvs genie on behalf of mschorn *** Bug 330762: Content assist for deferred base classes. [*] CompletionTests.java 1.54 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java?root=Tools_Project&r1=1.53&r2=1.54 [*] AccessContext.java 1.7 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AccessContext.java?root=Tools_Project&r1=1.6&r2=1.7 [*] BaseClassLookup.java 1.9 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BaseClassLookup.java?root=Tools_Project&r1=1.8&r2=1.9