1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +02:00

Bug 330747: Octal char constants in preprocessing condition.

This commit is contained in:
Markus Schorn 2010-11-24 08:17:34 +00:00
parent 49de2e7452
commit c18d5df1fd
2 changed files with 20 additions and 1 deletions

View file

@ -308,4 +308,23 @@ public class PreprocessorBugsTests extends PreprocessorTestsBase {
validateString("unsignedint f();");
validateEOF();
}
// #if '\0'
// no
// #else
// yes
// #endif
// #if '\1'
// yes
// #else
// no
// #endif
public void testOcatalCharConstant_Bug330747() throws Exception {
initializeScanner();
validateIdentifier("yes");
validateIdentifier("yes");
validateEOF();
validateProblemCount(0);
}
}

View file

@ -408,7 +408,7 @@ public class ExpressionEvaluator {
case 'v': return 0xb;
case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7':
return getNumber(tokenImage, i+1, tokenImage.length-1, 8, IProblem.SCANNER_BAD_OCTAL_FORMAT);
return getNumber(tokenImage, i, tokenImage.length-1, 8, IProblem.SCANNER_BAD_OCTAL_FORMAT);
case 'x': case 'u': case 'U':
return getNumber(tokenImage, i+1, tokenImage.length-1, 16, IProblem.SCANNER_BAD_HEX_FORMAT);