1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

Bug 495423 - Indexer produces a erroneous "Symbol could not be found"

Added catch all condition to ConditionalExpression type evaluation where
both positive and negative types are the same.

Change-Id: I990b502dfce8ef71c753ac188e072de312b7ea9f
Signed-off-by: Joseph Henry <joseph.henry@sas.com>
This commit is contained in:
Joseph Henry 2016-06-06 09:26:48 -04:00 committed by Gerrit Code Review @ Eclipse.org
parent eb21d06ecc
commit df6ebf09e9
2 changed files with 16 additions and 1 deletions

View file

@ -7554,6 +7554,17 @@ public class AST2Tests extends AST2TestBase {
parseAndCheckBindings(getAboveComment(), C);
}
// struct MyStruct {
// char* str;
// };
// void foo() {
// const struct MyStruct a, b;
// (0 ? a : b).str;
// }
public void testCVQualifiedTypesInConversionOperator_495423() throws Exception {
parseAndCheckBindings(getAboveComment(), C);
}
// _Alignas(8) int x;
// _Alignas(int) char y;
// _Alignas(16) struct { int x; int y; };

View file

@ -172,6 +172,10 @@ public class CASTConditionalExpression extends ASTNode implements
private IType computeResultType(IASTExpression positiveExpression, IASTExpression negativeExpression,
IType positiveType, IType negativeType) {
// Unwrap any top-level cv-qualifiers.
positiveType = CVisitor.unwrapCV(positiveType);
negativeType = CVisitor.unwrapCV(negativeType);
// [6.5.15] p5: If both the second and third operands have arithmetic type, the result type
// that would be determined by the usual arithmetic conversions, were they applied to those
// two operands, is the type of the result. If both operands have void type, the result has
@ -222,7 +226,7 @@ public class CASTConditionalExpression extends ASTNode implements
return new CPointerType(
ExpressionTypes.restoreCV(resultPointee, positivePointeeCV, negativePointeeCV), 0);
}
return null;
}