Thread overview |
---|
August 02, 2002 ..\ztc\cgobj.c 3034 | ||||
---|---|---|---|---|
| ||||
Oops! Can't I compile this: ________________________________ // file main.d import blah; int main() { blah.init(); printf("it is %i", it[0]); return 0; } _________________________________ // file blah.d module blah; void init() { it[0] = 32; } int[1] it; _________________________________ This causes an internal error. Moreover, if I write 'blah.it[0]' in function main() the compiler answers 'undefined identifier import blah.it' If it were not an array, the problem wouldn't disappear. Anyway, I'm wondering if that's legal. It should, shouldn't it? I wrote a similar code in a program of mine (a module with an array declaration, and another one which accesses that array). But when I compile those sources the compiler doesn't emit any error, and the resulting executable crashes (it outputs 'Error: ' and then crashes). Strange! |
August 02, 2002 Re: ..\ztc\cgobj.c 3034 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dario | As a workaround, compile the modules independently, and then link the .obj's together. It is legal code and should work. |
August 03, 2002 Re: ..\ztc\cgobj.c 3034 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | >>> As a workaround, compile the modules independently, and then link the .obj's together. It is legal code and should work. Walter >>> And why isn't blah.it[0] a valid identifier (if it is in another module)? Does it make any conflict? |
August 03, 2002 Re: ..\ztc\cgobj.c 3034 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dario | "Dario" <supdar@yahoo.com> wrote in message news:aih7mj$1cg$1@digitaldaemon.com... > >>> > As a workaround, compile the modules independently, and then link the .obj's > together. It is legal code and should work. Walter > > >>> > And why isn't blah.it[0] a valid identifier (if it is in another module)? > Does it make any conflict? It's a compiler bug. I have it fixed, and will fold it into the next update. -Walter |
Copyright © 1999-2021 by the D Language Foundation