1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00

Bug 459389 - [code assist] no members for deeply nested class templates

Change-Id: Ia6b3461325a9c489d10dd1356d46e7e6b6ee61f0
Signed-off-by: Michi <woskimi@yahoo.de>
This commit is contained in:
Michi 2015-02-08 16:08:27 +01:00 committed by Gerrit Code Review @ Eclipse.org
parent 23938e2b3d
commit 8a896c57ed
2 changed files with 32 additions and 5 deletions

View file

@ -180,9 +180,16 @@ public class AccessContext {
return false;
accessLevel = getMemberAccessLevel(derivedClass, accessLevel);
if (owner.isSameType(derivedClass) ||
(derivedClass instanceof ICPPClassSpecialization &&
owner.equals(((ICPPClassSpecialization) derivedClass).getSpecializedBinding()))) {
if (!(owner instanceof ICPPSpecialization)) {
while (derivedClass instanceof ICPPSpecialization) {
IBinding specialized = ((ICPPSpecialization) derivedClass).getSpecializedBinding();
if (specialized instanceof ICPPClassType) {
derivedClass = (ICPPClassType) specialized;
}
}
}
if (owner.isSameType(derivedClass)) {
return isAccessible(bindingVisibility, accessLevel);
}
@ -302,8 +309,10 @@ public class AccessContext {
if (maxdepth > 0) {
for (ICPPBase cppBase : ClassTypeHelper.getBases(derived, point)) {
IBinding base = cppBase.getBaseClass();
if (!(target instanceof ICPPSpecialization) && base instanceof ICPPSpecialization) {
base = ((ICPPSpecialization) base).getSpecializedBinding();
if (!(target instanceof ICPPSpecialization)) {
while (base instanceof ICPPSpecialization) {
base = ((ICPPSpecialization) base).getSpecializedBinding();
}
}
if (base instanceof ICPPClassType) {
ICPPClassType tbase = (ICPPClassType) base;

View file

@ -772,6 +772,24 @@ public class CompletionTests extends AbstractContentAssistTest {
assertCompletionResults(fCursorOffset, expected, ID);
}
// template <typename T>
// struct A {
// template <typename U>
// struct AA {
// template <typename V>
// struct AAA {
// };
// };
// };
//
// struct B : A<B> {
// AA<B>::/*cursor*/
// };
public void testMemebersForDeeplyNestedTemplates_459389() throws Exception {
final String[] expected = { "AAA<typename V>" };
assertCompletionResults(fCursorOffset, expected, DISPLAY);
}
// struct A {};
//
// template<typename T>