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

Bug 512932 - Do not perform extra type manipulations in EvalMemberAccess.computeType()

The manipulations removed in this change have no basis in the standard,
as far as I can tell by looking at [expr.ref].

Change-Id: I4fc8c342b590dbeb5a876543f736934c162034cc
This commit is contained in:
Nathan Ridge 2017-04-29 02:19:53 -04:00
parent d4841209b5
commit 432c3eaa04
2 changed files with 14 additions and 6 deletions

View file

@ -12269,4 +12269,18 @@ public class AST2CPPTests extends AST2TestBase {
public void testEnumeratorAttribute_514821() throws Exception {
parseAndCheckBindings(getAboveComment(), CPP, true /* use GNU extensions */);
}
// struct CType {
// char m_Array[4];
// };
//
// void foo(char(&)[4]);
//
// int main() {
// char name[sizeof(CType().m_Array)];
// foo(name);
// }
public void testSizeofArrayField_512932() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -15,7 +15,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.XVALUE;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.glvalueType;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.prvalueType;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.prvalueTypeWithResolvedTypedefs;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.typeFromFunctionCall;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ALLCVQ;
@ -265,11 +264,6 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
e2 = glvalueType(e2);
} else if (fMember instanceof ICPPField && !((ICPPField) fMember).isStatic()) {
e2 = addQualifiersForAccess((ICPPField) fMember, e2, fOwnerType);
if (!fIsPointerDeref && fOwnerValueCategory == PRVALUE) {
e2 = prvalueType(e2);
} else {
e2 = glvalueType(e2);
}
}
return SemanticUtil.mapToAST(e2, point);
}