www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - lazy in main

reply Carlos Santander <csantander619 gmail.com> writes:
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
Sep 05 2006
parent reply Kirk McDonald <kirklin.mcdonald gmail.com> writes:
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
Sep 05 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 -----BEGIN PGP SIGNATURE----- iD8DBQFE/9ZHLK5blCcjpWoRAtB/AJ9RwF/tVkSjJber3vkS8mzZYHAxOwCfSRAm qwpddA9mBw+tJ5Xg2gEDdVQ= =yM84 -----END PGP SIGNATURE-----
Sep 07 2006