D - ..\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!
Aug 02 2002
As a workaround, compile the modules independently, and then link the .obj's together. It is legal code and should work.
Aug 02 2002
As a workaround, compile the modules independently, and then link the .obj's together. It is legal code and should work. WalterAnd why isn't blah.it[0] a valid identifier (if it is in another module)? Does it make any conflict?
Aug 03 2002
"Dario" <supdar yahoo.com> wrote in message news:aih7mj$1cg$1 digitaldaemon.com....obj'sAs a workaround, compile the modules independently, and then link thetogether. It is legal code and should work. WalterIt's a compiler bug. I have it fixed, and will fold it into the next update. -WalterAnd why isn't blah.it[0] a valid identifier (if it is in another module)? Does it make any conflict?
Aug 03 2002








"Walter" <walter digitalmars.com>