1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +02:00

Fix for bug 269727.

This commit is contained in:
Sergey Prigogin 2009-03-24 00:58:32 +00:00
parent 32878a0b93
commit d66a77965a
3 changed files with 37 additions and 32 deletions

View file

@ -1084,6 +1084,26 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
getBindingFromASTName("A::B::m", 7, ICPPMethod.class);
}
// namespace ns {
// struct S {
// int a;
// };
// }
// class A {
// public:
// template<typename T> operator T*(){return 0;};
// };
// namespace ns {
// void bla() {
// A a;
// a.operator S *();
// }
// }
public void testLookupScopeForConversionNames_267221() throws Exception {
getBindingFromASTName("operator S *", 12, ICPPMethod.class);
}
private void assertBindings(String[] expected, ICPPBase[] bases) throws DOMException {
IBinding[] bindings= new IBinding[bases.length];
for (int i = 0; i < bindings.length; i++) {
@ -1116,34 +1136,4 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
buf.append('}');
return buf.toString();
}
// namespace ns {
// struct S {
// int a;
// };
// }
// class A {
// public:
// template<typename T> operator T*(){return 0;};
// };
// namespace ns {
// void bla() {
// A a;
// a.operator S *();
// }
// }
public void testLookupScopeForConversionNames_267221() throws Exception {
getBindingFromASTName("operator S *", 12, ICPPMethod.class);
}
// namespace ns1 { namespace ns2 {
// class A {};
// }}
// using namespace ns1::ns2;
// A a;
public void _testTwoLevelUsingDirective_269727() throws Exception {
getBindingFromASTName("A a", 1, ICPPClassType.class);
}
}

View file

@ -1346,6 +1346,17 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
checkValue(e.getValue(), 5);
}
// namespace ns1 { namespace ns2 {
// class A {};
// }}
// using namespace ns1::ns2;
// #include "header.h"
// A a;
public void testUsingDirectiveWithQualifiedName_269727() throws Exception {
getBindingFromASTName("A a", 1, ICPPClassType.class);
}
private void checkValue(IValue initialValue, int i) {
assertNotNull(initialValue);
final Long numericalValue = initialValue.numericalValue();
@ -1438,8 +1449,8 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
}
assertEquals(expectedEnumerators, actualEnumerators);
}
/**
*
/**
* @param binding
* @param cqn
* @param qn may be null

View file

@ -866,6 +866,10 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
}
}
} else if (parentNode instanceof ICPPASTUsingDirective) {
IASTNode parent= name.getParent();
if (parent instanceof ICPPASTQualifiedName) {
name = (IASTName) parent;
}
IScope container= CPPVisitor.getContainingScope(name);
try {
boolean doit= false;