Bug 466 – dmd prevent this from link, if so please prevent it from compiling
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-10-28T03:51:00Z
Last change time
2014-02-15T13:21:48Z
Keywords
link-failure
Assigned to
bugzilla
Creator
davidl
Comments
Comment #0 by davidl — 2006-10-28T03:51:58Z
import std.stdio;
class Exception
{
char[] Exception;
}
void caller()
{
int count=0;
void func(lazy char [] errormessage) // if it can be a nested func inside the caller would be nice
{
count++;
if (count<3)
{
throw new Exception(errormessage);
}
}
try
{
delete_directory("/home/someuser") ;
}
catch
{
};
}
void delete_directory(char [] dirname)
{
// caller.func("hurray");
// caller.func("hurray");
// caller.func("hurray");
}
void main()
{
caller();
}
and the example code here is trying to interact with the try block owner
i hope compiler would be able to generate the func in the example.
like we have code
import std.stdio;
class Exception
{
char[] Exception;
}
void caller()
{
int count=0;
try
{
delete_directory("/home/someuser") ;
}
catch
{
count++;
if (count<3)
{
continue; // i want that to continue the point where throw the exception
}
};
}
void delete_directory(char [] dirname)
{
throw new Exception("File1"); // maybe we can add a keyword like action, to let the try block to determine how to deal with the action, then we won't affect the exception we have now;
throw new Exception("File2");
throw new Exception("File3");
// caller.func("hurray");
// caller.func("hurray");
// caller.func("hurray");
}
void main()
{
caller();
}