Thread overview
lazy in main
Sep 05, 2006
Carlos Santander
Sep 05, 2006
Kirk McDonald
Sep 07, 2006
Thomas Kuehne
September 05, 2006
This compiles successfully:

int main (lazy char [][] args)
{
        return args.length;
}

But at runtime I get "Illegal instruction". Tested with gdc from SVN repos (uses dmd 0.166) on Mac OS X.

-- 
Carlos Santander Bernal
September 05, 2006
Carlos Santander wrote:
> This compiles successfully:
> 
> int main (lazy char [][] args)
> {
>         return args.length;
> }
> 
> But at runtime I get "Illegal instruction". Tested with gdc from SVN repos (uses dmd 0.166) on Mac OS X.
> 

I would call this a bug in the compiler. The spec states there are only four valid forms of main:

void main() { ... }
void main(char[][] args) { ... }
int main() { ... }
int main(char[][] args) { ... }

http://digitalmars.com/d/function.html

Since that isn't one of them, I would think the compiler should issue an error.

-- 
Kirk McDonald
Pyd: Wrapping Python with D
http://pyd.dsource.org
September 07, 2006
Kirk McDonald schrieb am 2006-09-05:
> Carlos Santander wrote:
>> This compiles successfully:
>> 
>> int main (lazy char [][] args)
>> {
>>         return args.length;
>> }
>> 
>> But at runtime I get "Illegal instruction". Tested with gdc from SVN repos (uses dmd 0.166) on Mac OS X.
>> 
>
> I would call this a bug in the compiler. The spec states there are only four valid forms of main:
>
> void main() { ... }
> void main(char[][] args) { ... }
> int main() { ... }
> int main(char[][] args) { ... }
>
> http://digitalmars.com/d/function.html
>
> Since that isn't one of them, I would think the compiler should issue an error.

Added to DStress as http://dstress.kuehne.cn/nocompile/m/main_07_A.d http://dstress.kuehne.cn/nocompile/m/main_07_B.d

Thomas