mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
Patch from Devin Steffler: [Scanner] Wrong compare if the two declarations are in other number system
This commit is contained in:
parent
dc2c9cec11
commit
654fb767a2
2 changed files with 24 additions and 2 deletions
|
@ -14,6 +14,7 @@ import java.io.StringWriter;
|
|||
import java.io.Writer;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IProblem;
|
||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
|
||||
|
@ -2241,5 +2242,26 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
|||
IASTTypeId typeId = (IASTTypeId) typeIds.next();
|
||||
assertEquals( typeId.getTypeOrClassName(), "Thrown" );
|
||||
}
|
||||
|
||||
public void testBug75532() throws Exception
|
||||
{
|
||||
try {
|
||||
Writer writer = new StringWriter();
|
||||
writer.write( "#if 2147483647 == 0x7fffffff\n");
|
||||
writer.write( "#error This was equal, but not for the eclipse.\n");
|
||||
writer.write( "#endif\n");
|
||||
parse( writer.toString() );
|
||||
|
||||
assertTrue(false);
|
||||
} catch (ParserException pe) {
|
||||
// expected IProblem
|
||||
} finally {
|
||||
assertTrue( callback.getProblems().hasNext() );
|
||||
Object ipo = callback.getProblems().next();
|
||||
assertTrue( ipo instanceof IProblem );
|
||||
IProblem ip = (IProblem)callback.getProblems().next();
|
||||
assertTrue(ip.getArguments().indexOf("This was equal, but not for the eclipse") > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -459,11 +459,11 @@ public class ExpressionEvaluator {
|
|||
continue;
|
||||
} else if (isHex) {
|
||||
if (c >= 'a' && c <= 'f') {
|
||||
tokenValue *= 16;
|
||||
tokenValue = (tokenValue == 0 ? 10 : (tokenValue * 16) + 10);
|
||||
tokenValue += c - 'a';
|
||||
continue;
|
||||
} else if (c >= 'A' && c <= 'F') {
|
||||
tokenValue *= 16;
|
||||
tokenValue = (tokenValue == 0 ? 10 : (tokenValue * 16) + 10);
|
||||
tokenValue += c - 'A';
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue