[Bug 74] New: compiler error using if auto condition and -inline
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Mar 25 21:38:28 PST 2006
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 at digitalmars.com
ReportedBy: godaves at 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;
}
}
}
--
More information about the Digitalmars-d-bugs
mailing list