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

Expression type for array-access on unknown binding.

This commit is contained in:
Markus Schorn 2009-01-27 18:25:52 +00:00
parent c0b169fb8c
commit 9bf79183b4
2 changed files with 17 additions and 0 deletions

View file

@ -3702,4 +3702,18 @@ public class AST2TemplateTests extends AST2BaseTest {
String code= getAboveComment();
parseAndCheckBindings(code, ParserLanguage.CPP);
}
// class C {};
// template<typename T> class XT {
// T field;
// void bla() {
// C c;
// field[0].m(c);
// }
// };
public void testResolutionOfUnknownArrayAccess() throws Exception {
String code= getAboveComment();
parseAndCheckBindings(code, ParserLanguage.CPP);
}
}

View file

@ -120,6 +120,9 @@ public class CPPASTArraySubscriptExpression extends ASTNode implements IASTArray
IType t = getArrayExpression().getExpressionType();
t= SemanticUtil.getUltimateTypeUptoPointers(t);
try {
if (t instanceof ICPPUnknownType) {
return CPPUnknownClass.createUnnamedInstance();
}
if (t instanceof ICPPClassType) {
ICPPFunction op = CPPSemantics.findOperator(this, (ICPPClassType) t);
if (op != null) {