www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 466] New: dmd prevent this from link , if so please prevent it from compiling

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=466

           Summary: dmd prevent this from link , if so please prevent it
                    from compiling
           Product: D
           Version: 0.173
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: davidl 126.com


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();
}


-- 
Oct 28 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-10-28:
 http://d.puremagic.com/issues/show_bug.cgi?id=466

 import std.stdio;
 class Exception
 {
     char[] Exception;
 }

Added to DStress as http://dstress.kuehne.cn/compile/m/mangleof_17_A.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFUfcsLK5blCcjpWoRAnmyAJwOyYexZ0ZwslTbYboDtm6VbyBN2gCdEtOf p/KEQO2mO2akZVGNcd9rlDU= =9Phy -----END PGP SIGNATURE-----
Nov 08 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=466


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from bugzilla digitalmars.com  2006-11-25 03:55 -------
Fixed DMD 0.175


-- 
Nov 25 2006