digitalmars.D.bugs - Nested main function should be treated like a common function
- zwang (5/5) Feb 03 2005 Nested main function should be treated like a common function.
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (6/14) Feb 03 2005 Should probably include a check with !isNested() as well... ?
- Thomas Kuehne (12/17) Feb 03 2005 -----BEGIN PGP SIGNED MESSAGE-----
- zwang (2/28) Feb 03 2005
Nested main function should be treated like a common function. If void f(){int main(){return 0;}} is acceptable, why isn't void f(){int main(int){return 0;}} ? PS. DMD 0.112 displays the following error message: function test.f.main parameters must be main() or main(char[][] args)
Feb 03 2005
zwang wrote:Nested main function should be treated like a common function. If void f(){int main(){return 0;}} is acceptable, why isn't void f(){int main(int){return 0;}} ?Sounds like a bug in dmd/func.c, int FuncDeclaration::isMain :int FuncDeclaration::isMain() { return ident && strcmp(ident->toChars(), "main") == 0 && linkage != LINKc && !isMember(); }Should probably include a check with !isNested() as well... ? --anders PS. I find this to be more amusing: cdouble main() { return 0 + 0i; }
Feb 03 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 zwang schrieb am Thu, 03 Feb 2005 22:37:02 +0800:Nested main function should be treated like a common function. If void f(){int main(){return 0;}} is acceptable, why isn't void f(){int main(int){return 0;}} ? PS. DMD 0.112 displays the following error message: function test.f.main parameters must be main() or main(char[][] args)Added to DStress as http://dstress.kuehne.cn/run/nested_function_05.d http://dstress.kuehne.cn/run/nested_function_06.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCAj+/3w+/yD4P9tIRAoOsAJ0aPaNv76ROMRpm6dXReqTMXxF4eQCdGJH2 5BxcNBieCCUDxyWBss5LqTI= =Ak6A -----END PGP SIGNATURE-----
Feb 03 2005
So fast :) Thomas Kuehne wrote:-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 zwang schrieb am Thu, 03 Feb 2005 22:37:02 +0800:Nested main function should be treated like a common function. If void f(){int main(){return 0;}} is acceptable, why isn't void f(){int main(int){return 0;}} ? PS. DMD 0.112 displays the following error message: function test.f.main parameters must be main() or main(char[][] args)Added to DStress as http://dstress.kuehne.cn/run/nested_function_05.d http://dstress.kuehne.cn/run/nested_function_06.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCAj+/3w+/yD4P9tIRAoOsAJ0aPaNv76ROMRpm6dXReqTMXxF4eQCdGJH2 5BxcNBieCCUDxyWBss5LqTI= =Ak6A -----END PGP SIGNATURE-----
Feb 03 2005