Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330762

Summary: Content-assist fails for members of deferred class instances.
Product: [Tools] CDT Reporter: Tim <minesadab>
Component: cdt-parserAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Markus Schorn <mschorn.eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug
Version: 8.0   
Target Milestone: 8.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
testcase + fix mschorn.eclipse: iplog-

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.