Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
November 12, 2011 [dmd-internals] Odd lookup bug | ||||
---|---|---|---|---|
| ||||
I tracked down an odd bug in name lookup. With the latest and greatest version of everything, do this: cd /path/to/phobos dmd -w -m32 -d -c -o- -I../druntime/import -unittest std/file.d That works handsomely. Now try this: dmd -w -m32 -d -c -o- -I../druntime/import std/file.d Compilation fails with: std/file.d(1945): Error: undefined identifier package c.stdlib Fix that, and there will be others. Apparently lookup proceeds differently with -unittest, because I cannot see any import of std.c.stdlib guarded by version(unittest). Any idea of what's happening? Andrei |
November 12, 2011 [dmd-internals] Odd lookup bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu |
On 11/12/2011 5:55 PM, Andrei Alexandrescu wrote:
> I tracked down an odd bug in name lookup. With the latest and greatest version of everything, do this:
>
> cd /path/to/phobos
> dmd -w -m32 -d -c -o- -I../druntime/import -unittest std/file.d
>
> That works handsomely. Now try this:
>
> dmd -w -m32 -d -c -o- -I../druntime/import std/file.d
>
> Compilation fails with:
>
> std/file.d(1945): Error: undefined identifier package c.stdlib
>
> Fix that, and there will be others. Apparently lookup proceeds differently with -unittest, because I cannot see any import of std.c.stdlib guarded by version(unittest).
>
> Any idea of what's happening?
>
No, but std.file imports about everything else in Phobos, and there are many imports conditioned upon unittest.
|
November 12, 2011 [dmd-internals] Odd lookup bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 11/12/11 8:22 PM, Walter Bright wrote:
> No, but std.file imports about everything else in Phobos, and there are many imports conditioned upon unittest.
No public imports are ever conditioned upon unittest, so this is really about a bug that has been discussed a short time ago: importing a module gives you surreptitious access to that module's private imports.
Andrei
|
November 13, 2011 [dmd-internals] Odd lookup bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Sunday 13 November 2011 02:55 Andrei Alexandrescu wrote: > I tracked down an odd bug in name lookup. With the latest and greatest version of everything, do this: > > cd /path/to/phobos > dmd -w -m32 -d -c -o- -I../druntime/import -unittest std/file.d > > That works handsomely. Now try this: > > dmd -w -m32 -d -c -o- -I../druntime/import std/file.d > > Compilation fails with: > > std/file.d(1945): Error: undefined identifier package c.stdlib > > Fix that, and there will be others. Apparently lookup proceeds differently with -unittest, because I cannot see any import of std.c.stdlib guarded by version(unittest). > > Any idea of what's happening? It's bug http://d.puremagic.com/issues/show_bug.cgi?id=6307 . with -unittest: std.algorithm -> std.random -> std.numeric -> std.c.stdlib without -unittest, no one imports std.c.stdlib. Christian |
November 13, 2011 [dmd-internals] Odd lookup bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christian Kamm | On 11/13/11 12:47 AM, Christian Kamm wrote:
> It's bug http://d.puremagic.com/issues/show_bug.cgi?id=6307 .
>
> with -unittest:
> std.algorithm -> std.random -> std.numeric -> std.c.stdlib
>
> without -unittest, no one imports std.c.stdlib.
Thanks, that is it. It's a bit ironic how the issue never comes up during phobos builds, but instead when building d-programming-language.com.
I made a commit that fixes all instances.
Andrei
|
November 13, 2011 [dmd-internals] Odd lookup bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | There is a similar issue with std.regex: import std.regex; void main() { auto re = regex("a"); } "dmd test.d" or "dmd -debug -unittest test.d" work fine, but "dmd -debug test.d" yields m:\s\d\rainers\phobos\std\regex.d(2840): Error: undefined identifier writefln due to "version(unittest) debug import std.stdio;" in std.regex. Rainer On 13.11.2011 14:30, Andrei Alexandrescu wrote: > On 11/13/11 12:47 AM, Christian Kamm wrote: >> It's bug http://d.puremagic.com/issues/show_bug.cgi?id=6307 . >> >> with -unittest: >> std.algorithm -> std.random -> std.numeric -> std.c.stdlib >> >> without -unittest, no one imports std.c.stdlib. > > Thanks, that is it. It's a bit ironic how the issue never comes up during phobos builds, but instead when building d-programming-language.com. > > I made a commit that fixes all instances. > > > Andrei > _______________________________________________ > dmd-internals mailing list > dmd-internals at puremagic.com > http://lists.puremagic.com/mailman/listinfo/dmd-internals > |
Copyright © 1999-2021 by the D Language Foundation