Literals starting with 0 will not work with UFCS

Jonathan M Davis jmdavisProg at gmx.com
Tue Jul 3 17:34:21 PDT 2012


On Wednesday, July 04, 2012 02:20:26 ixid wrote:
> 0.writeln();

This works.

> 01.writeln();

This doesn't.

> etc...
> 
> Throw up a series of errors while any other number as the leading
> digit seems to work fine. Why is this?

It's probably an artifact of getting rid of octal literals and is clearly a 
bug - though you probably shouldn't be starting literals with 0 due to 
possible confusion with octal literals anyway (00 - 07 are permitted because 
they're the same in both octal and decimal, but any other number literal 
starting with 0 is illegal).

The error you get for something like

auto n = 08;

is a bit off too

q.d(5): Error: semicolon expected following auto declaration, not '8'

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list