mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Bug 448764 - Type of EvalMemberAccess for dependent member
Change-Id: I011ceca370e584e802354f935cc9ce004641f8f1 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
This commit is contained in:
parent
5e2c5d8491
commit
a662bcc921
2 changed files with 22 additions and 4 deletions
|
@ -50,7 +50,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPUnknownMemberClass;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalUnknownScope;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalUnknownScope;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.OverloadableOperator;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.OverloadableOperator;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics.LookupMode;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics.LookupMode;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -233,8 +232,6 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
|
||||||
if (fMember instanceof IVariable) {
|
if (fMember instanceof IVariable) {
|
||||||
IType e2 = ((IVariable) fMember).getType();
|
IType e2 = ((IVariable) fMember).getType();
|
||||||
e2= SemanticUtil.getNestedType(e2, TDEF);
|
e2= SemanticUtil.getNestedType(e2, TDEF);
|
||||||
if (e2 instanceof ICPPUnknownType)
|
|
||||||
return new TypeOfDependentExpression(this);
|
|
||||||
if (e2 instanceof ICPPReferenceType) {
|
if (e2 instanceof ICPPReferenceType) {
|
||||||
e2= glvalueType(e2);
|
e2= glvalueType(e2);
|
||||||
} else if (fMember instanceof ICPPField && !((ICPPField) fMember).isStatic()) {
|
} else if (fMember instanceof ICPPField && !((ICPPField) fMember).isStatic()) {
|
||||||
|
|
|
@ -1230,9 +1230,30 @@ public class CPPSelectionTestsNoIndexer extends BaseUITestCase {
|
||||||
// }
|
// }
|
||||||
public void testLocallyDeclaredExternVariable_372004() throws Exception {
|
public void testLocallyDeclaredExternVariable_372004() throws Exception {
|
||||||
String code = getAboveComment();
|
String code = getAboveComment();
|
||||||
IFile file = importFile("testWaldo.cpp", code);
|
IFile file = importFile("testBug372004.cpp", code);
|
||||||
|
|
||||||
int offset = code.indexOf("extern int waldo") + 12;
|
int offset = code.indexOf("extern int waldo") + 12;
|
||||||
assertTrue(testF3(file, offset) instanceof IASTName);
|
assertTrue(testF3(file, offset) instanceof IASTName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template <typename>
|
||||||
|
// struct A {
|
||||||
|
// int waldo;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template <typename T>
|
||||||
|
// struct B {
|
||||||
|
// A<T> obj;
|
||||||
|
// void foo() {
|
||||||
|
// obj.waldo;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
public void testDependentMemberAccess_448764() throws Exception {
|
||||||
|
String code = getAboveComment();
|
||||||
|
IFile file = importFile("testBug448764.cpp", code);
|
||||||
|
|
||||||
|
int offset = code.indexOf("obj.waldo") + 4;
|
||||||
|
assertTrue(testF3(file, offset) instanceof IASTName);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue