Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330762 - Content-assist fails for members of deferred class instances.
Summary: Content-assist fails for members of deferred class instances.
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 8.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: Markus Schorn CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-21 17:51 EST by Tim CLA
Modified: 2010-12-02 08:23 EST (History)
1 user (show)

See Also:


Attachments
testcase + fix (4.09 KB, patch)
2010-12-02 06:25 EST, Markus Schorn CLA
mschorn.eclipse: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim CLA 2010-11-21 17:51:20 EST
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.
Comment 1 Markus Schorn CLA 2010-11-24 03:59:25 EST
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.
Comment 2 Markus Schorn CLA 2010-12-02 06:25:23 EST
Created attachment 184338 [details]
testcase + fix

Implements the fallback to the primary template when the base class is a deferred instance.
Comment 3 Markus Schorn CLA 2010-12-02 07:31:38 EST
Fixed in 8.0 > 20101202.