diff --git a/src/scan-gram.l b/src/scan-gram.l index d3662690..07192f2b 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -846,6 +846,10 @@ static unsigned long scan_integer (char const *number, int base, location loc) { verify (INT_MAX < ULONG_MAX); + if (base == 16) + complain (&loc, Wyacc, + _("POSIX Yacc does not support hexadecimal literals")); + unsigned long num = strtoul (number, NULL, base); if (INT_MAX < num) diff --git a/tests/input.at b/tests/input.at index 2b0b5573..2a20c404 100644 --- a/tests/input.at +++ b/tests/input.at @@ -147,6 +147,9 @@ AT_BISON_CHECK([-fcaret -Wyacc input.y], [0], [], [[input.y:1.1-6: warning: POSIX Yacc does not support %nterm [-Wyacc] %nterm exp ^^^^^^ +input.y:2.12-15: warning: POSIX Yacc does not support hexadecimal literals [-Wyacc] + %token NUM 0x40 "number" + ^^^^ ]]) AT_CLEANUP