preprocessor/8449: Ellipsis in 3...5 not recognized properly
Neil Booth
neil@daikokuya.co.uk
Thu Nov 7 00:25:00 GMT 2002
ehrhardt@mathematik.uni-ulm.de wrote:-
> Compiling this:
>
> int a[2] = {[0 ...1]=1};
>
> with gcc -c t.c gives an error:
> gcc -c t9.c
> t9.c:1: too many decimal points in floating constant
> The cause is quite obious: The ellipsis is parsed as part of the
> number. Something along these lines might fix it (only compile tested
> as of yet)
As I expected, I couldn't reproduce this. Could you elaborate?
Are you using stock GCC? The code in cpplex.c IMO clearly handles
ellipses correctly, even with escaped newlines, and has nothing to
do with numbers:
case '.':
result->type = CPP_DOT;
c = get_effective_char (pfile);
if (c == '.')
{
const unsigned char *pos = buffer->cur;
if (get_effective_char (pfile) == '.')
result->type = CPP_ELLIPSIS;
else
buffer->cur = pos - 1;
}
So, assuming the case '.' code is reached, which it would appear to
be since the "..." appears after whitespace (which causes a loop back
to re-enter the switch) I don't see how this can fail.
What ASCII character is after the '0' in your line above? Maybe it's
not be the space it appears to be.
Neil.
More information about the Gcc-bugs
mailing list