Bug 177055 - CPPClassSpecialization is incomplete and wrong
Summary: CPPClassSpecialization is incomplete and wrong
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 4.0 M6   Edit
Assignee: Doug Schaefer CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-03-12 15:51 EDT by Andrew Niefer CLA
Modified: 2008-06-20 10:59 EDT (History)
1 user (show)

See Also:


Attachments
proposed patch (50.33 KB, patch)
2007-03-23 11:40 EDT, Bryan Wilkinson CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Niefer CLA 2007-03-12 15:51:48 EDT
The implementation of CPPClassSpecialization is incomplete and its method getBases is wrong.  For better template handling we would want at least correct implementations of getBases, getConstructors, getConversionOperators and createDelegate.  Below are 2 examples of code where content assist fails because of the getBases.

Example 1:
class Base {
	public: int b1;
};

template <class T> class A {
	class C : public T {};
};

int main(int argc, char **argv) {
	A<Base>::C c;
	c.b[CTRL-SPACE];
}
Content assist fails for b.  c's type, A<Base>::C, is a CPPClassSpecialization.

Example 2:
class Base {
	public: int b1;
};

template <class T> class A {
};
template <> class A<Base> : public Base {
}
int main(int argc, char **argv) {
	A<Base> a;
	a.b[CTRL-SPACE];
}
a's type is the explicit specialization of the template, and is a CPPClassSpecialization.
Comment 1 Bryan Wilkinson CLA 2007-03-23 11:40:07 EDT
Created attachment 61840 [details]
proposed patch

Patch implements the required methods of CPPClassSepcialization.  Also, the behaviour of getCompositeScope() now depends on whether or not the class specialization is explicit.  If it is not explicit, the scope behaves the same way as a CPPClassInstance's scope, by specializing everything in the scope.
Comment 2 Doug Schaefer CLA 2007-03-23 15:52:55 EDT
Getting to it...
Comment 3 Doug Schaefer CLA 2007-03-23 16:05:24 EDT
Patch applied. Thanks!