mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +02:00
Expression type for array-access on unknown binding.
This commit is contained in:
parent
c0b169fb8c
commit
9bf79183b4
2 changed files with 17 additions and 0 deletions
|
@ -3702,4 +3702,18 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
String code= getAboveComment();
|
String code= getAboveComment();
|
||||||
parseAndCheckBindings(code, ParserLanguage.CPP);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,6 +120,9 @@ public class CPPASTArraySubscriptExpression extends ASTNode implements IASTArray
|
||||||
IType t = getArrayExpression().getExpressionType();
|
IType t = getArrayExpression().getExpressionType();
|
||||||
t= SemanticUtil.getUltimateTypeUptoPointers(t);
|
t= SemanticUtil.getUltimateTypeUptoPointers(t);
|
||||||
try {
|
try {
|
||||||
|
if (t instanceof ICPPUnknownType) {
|
||||||
|
return CPPUnknownClass.createUnnamedInstance();
|
||||||
|
}
|
||||||
if (t instanceof ICPPClassType) {
|
if (t instanceof ICPPClassType) {
|
||||||
ICPPFunction op = CPPSemantics.findOperator(this, (ICPPClassType) t);
|
ICPPFunction op = CPPSemantics.findOperator(this, (ICPPClassType) t);
|
||||||
if (op != null) {
|
if (op != null) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue