Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311164 - getDefinitions() call on an AST returns incorrect array for a specialized template binding
Summary: getDefinitions() call on an AST returns incorrect array for a specialized tem...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 7.0   Edit
Assignee: Markus Schorn CLA
QA Contact: Mike Kucera CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-30 08:29 EDT by Pavan V CLA
Modified: 2010-10-07 10:23 EDT (History)
1 user (show)

See Also:


Attachments
testcase + fix (9.16 KB, patch)
2010-05-19 07:09 EDT, Markus Schorn CLA
mschorn.eclipse: iplog-
Details | Diff
follow up on the fix (8.49 KB, patch)
2010-10-07 09:46 EDT, 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 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).