Bug 74 – compiler error using if auto condition and -inline
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2006-03-25T23:38:00Z
Last change time
2014-02-15T02:09:16Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
godaves
Comments
Comment #0 by godaves — 2006-03-25T23:38:26Z
/*
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;
}
}
}