Bug 15277 – unable to compile .d flies with numbers at the beginning of the name
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2015-11-02T21:44:00Z
Last change time
2015-11-02T22:24:15Z
Assigned to
nobody
Creator
steven_kladitis
Comments
Comment #0 by steven_kladitis — 2015-11-02T21:44:31Z
any .d file with a number in the beginning of the name will not compile with dmd.
filename -> 1.d
or -> 1a1aa1.d
-----
void main () {}
--------------------
if I rename with a leading letter dmd seems to like it.
I see
1.d: Error: module 1 has non-identifier characters in filename, use module declaration instead.
this is dmd 2.069 rc2
I am looking to see if imports have this problem also.
Comment #1 by ag0aep6g — 2015-11-02T22:24:15Z
As far as I can see, everything works as expected here.
dmd doesn't mind "1.d" as a file name.
What's rejected is "1" as a module name. The module name is taken from the file name when there is no module declaration (`module foo;`). Module names are specified to be identifiers [1]. Identifiers are specified not to start with digits [2].
Closing as invalid. Please reopen if I'm missing something here.
[1] http://dlang.org/module.html#ModuleName
[2] http://dlang.org/lex.html#IdentifierStart