http://d.puremagic.com/issues/show_bug.cgi?id=3573

           Summary: pure and nothrow are not enforced when function has no
                    return type specified
           Product: D
           Version: 2.036
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: michal.min...@gmail.com


--- Comment #0 from Michal Minich <michal.min...@gmail.com> 2009-12-04 02:39:36 
PST ---
there are 3 related problems:

1. it is possible to declare function without specifying return type.

pure foo () {}
pure foo () {}
pure nothrow foo () {}

should be: pure nothrow void foo () {}

2. pure is not enforced when return type is omitted

int bar  = 3;
pure foo () { bar = 42; }

void main ()
{
    writeln (bar); // writes 3
    foo ();
    writeln (bar); // writes 42
}

3. nothrow is not enforced when return type is omitted

nothrow foo () { throw new Exception (""); }

void main ()
{
    foo (); // throws exception
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to