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

Bug 311164

Summary: getDefinitions() call on an AST returns incorrect array for a specialized template binding
Product: [Tools] CDT Reporter: Pavan V <pavan.ananth>
Component: cdt-parserAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Mike Kucera <mikekucera>
Severity: normal    
Priority: P3 CC: sanjesh.nair
Version: 7.0   
Target Milestone: 7.0   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
testcase + fix
mschorn.eclipse: iplog-
follow up on the fix mschorn.eclipse: iplog-

Description Pavan V CLA 2010-04-30 08:29:58 EDT
I have a C++ header file that contains:

template<class T1,class T2>
class Temp_Class
{
  
};

template<>
class Temp_Class<int,char>
{
    
};

template<>
class Temp_Class<char,char>
{

};

I have a handle to the binding of the spec template class Temp_Class<int, char> (ICPPSpecialization) and a handle to the AST of the header file. When I call getDefinitionsInAST(binding) on the AST, the array returned contained all of the above three IASTNames in the list. 

The AST call should resolve and return the correct class being referred to using the binding information
Comment 1 Markus Schorn CLA 2010-05-19 07:09:34 EDT
Created attachment 169090 [details]
testcase + fix

The previous behavior was chosen to implement navigation from specializations to the template definition, see bug 92632. Navigation still works as expected, because today the navigation code deals with specializations.
Comment 2 Markus Schorn CLA 2010-05-19 07:11:47 EDT
Fixed in 7.0 > 20100519.
Comment 4 Markus Schorn CLA 2010-10-07 09:46:49 EDT
Created attachment 180423 [details]
follow up on the fix

The fix had a negative impact on the mark occurrences feature. The patch changes the implementation such that it returns the relevant declarations for a specialization (for an explicit specialization this does not include the template).