mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 245068.
This commit is contained in:
parent
cb5c6721aa
commit
44b6373985
2 changed files with 22 additions and 2 deletions
|
@ -6119,6 +6119,22 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
assertSame(ors[0], m1);
|
assertSame(ors[0], m1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// struct A {
|
||||||
|
// int a;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// void test(A* p) {
|
||||||
|
// p.a; // should not resolve
|
||||||
|
// }
|
||||||
|
public void testPointerMemberAccess_245068() throws Exception {
|
||||||
|
final String comment= getAboveComment();
|
||||||
|
final boolean[] isCpps= {false, true};
|
||||||
|
for (boolean isCpp : isCpps) {
|
||||||
|
BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp);
|
||||||
|
ba.assertProblem("a; // should not resolve", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// void f();
|
// void f();
|
||||||
//
|
//
|
||||||
// void test(int p) {
|
// void test(int p) {
|
||||||
|
|
|
@ -925,7 +925,11 @@ public class CPPVisitor {
|
||||||
} else if (parent instanceof ICPPASTFieldReference) {
|
} else if (parent instanceof ICPPASTFieldReference) {
|
||||||
final ICPPASTFieldReference fieldReference = (ICPPASTFieldReference)parent;
|
final ICPPASTFieldReference fieldReference = (ICPPASTFieldReference)parent;
|
||||||
IType type = CPPSemantics.getChainedMemberAccessOperatorReturnType(fieldReference);
|
IType type = CPPSemantics.getChainedMemberAccessOperatorReturnType(fieldReference);
|
||||||
type= getUltimateType(type, false);
|
if (fieldReference.isPointerDereference()) {
|
||||||
|
type= getUltimateType(type, false);
|
||||||
|
} else {
|
||||||
|
type= getUltimateTypeUptoPointers(type);
|
||||||
|
}
|
||||||
if (type instanceof ICPPClassType) {
|
if (type instanceof ICPPClassType) {
|
||||||
return ((ICPPClassType) type).getCompositeScope();
|
return ((ICPPClassType) type).getCompositeScope();
|
||||||
}
|
}
|
||||||
|
@ -2385,7 +2389,7 @@ public class CPPVisitor {
|
||||||
*/
|
*/
|
||||||
public static final IASTExpression reverseConstantPropagationLookup(IASTExpression e1) {
|
public static final IASTExpression reverseConstantPropagationLookup(IASTExpression e1) {
|
||||||
try {
|
try {
|
||||||
for(int i= 0; e1 instanceof IASTIdExpression && i < 8; i++) {
|
for (int i= 0; e1 instanceof IASTIdExpression && i < 8; i++) {
|
||||||
IBinding b1= ((IASTIdExpression)e1).getName().resolveBinding();
|
IBinding b1= ((IASTIdExpression)e1).getName().resolveBinding();
|
||||||
if (b1 instanceof ICPPVariable) {
|
if (b1 instanceof ICPPVariable) {
|
||||||
ICPPVariable var= (ICPPVariable) b1;
|
ICPPVariable var= (ICPPVariable) b1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue