digitalmars.D.bugs - [Bug 74] New: compiler error using if auto condition and -inline
- d-bugmail puremagic.com (58/58) Mar 25 2006 http://d.puremagic.com/bugzilla/show_bug.cgi?id=74
- Thomas Kuehne (18/64) Mar 26 2006 -----BEGIN PGP SIGNED MESSAGE-----
http://d.puremagic.com/bugzilla/show_bug.cgi?id=74
Summary: compiler error using if auto condition and -inline
Product: D
Version: 0.150
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: godaves yahoo.com
/*
compile with dmd -inline -version=BUG
compiler error:
(13): function bug.foo is a nested function and cannot be accessed from
main
(18): function bug.foo is a nested function and cannot be accessed from
main
*/
import std.stdio;
void main()
{
writefln(foo(5));
}
int foo(int i)
{
version(BUG)
{
if (auto j = i * i)
return j;
else
return 10;
}
else
{
version(OK1)
{
if (auto j = i * i) // NOTE: w/ {}'s it compiles fine
{
return j;
}
else
{
return 10;
}
}
else
{
auto j = i * i; // Works Ok as well
if(j)
return j;
else
return 10;
}
}
}
--
Mar 25 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
d-bugmail puremagic.com schrieb am 2006-03-26:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=74
/*
compile with dmd -inline -version=BUG
compiler error:
(13): function bug.foo is a nested function and cannot be accessed from
main
(18): function bug.foo is a nested function and cannot be accessed from
main
*/
import std.stdio;
void main()
{
writefln(foo(5));
}
int foo(int i)
{
version(BUG)
{
if (auto j = i * i)
return j;
else
return 10;
}
else
{
version(OK1)
{
if (auto j = i * i) // NOTE: w/ {}'s it compiles fine
{
return j;
}
else
{
return 10;
}
}
else
{
auto j = i * i; // Works Ok as well
if(j)
return j;
else
return 10;
}
}
}
Added to DStress as
http://dstress.kuehne.cn/run/i/if_14_A.d
http://dstress.kuehne.cn/run/i/if_14_B.d
http://dstress.kuehne.cn/run/i/if_14_C.d
http://dstress.kuehne.cn/run/i/if_14_D.d
http://dstress.kuehne.cn/run/i/if_14_E.d
http://dstress.kuehne.cn/run/i/if_14_F.d
http://dstress.kuehne.cn/run/i/if_14_G.d
http://dstress.kuehne.cn/run/i/if_14_H.d
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFEJnVm3w+/yD4P9tIRAsooAJ0cu/Wwa4GfDTqH3eBoVs3eRpagzgCfZMcK
o+t7OQZLH6TiA+sqjAqLl9g=
=x149
-----END PGP SIGNATURE-----
Mar 26 2006








Thomas Kuehne <thomas-dloop kuehne.cn>