December 04, 2009
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: nobody@puremagic.com
        ReportedBy: michal.minich@gmail.com


--- Comment #0 from Michal Minich <michal.minich@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: -------
December 08, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3573


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
                 CC|                            |clugdbug@yahoo.com.au
            Summary|pure and nothrow are not    |pure and nothrow allow
                   |enforced when function has  |function return type to be
                   |no return type specified    |inferred
           Severity|normal                      |minor


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-12-08 04:39:43 PST ---
Points 2 and 3 were fixed in DMD svn 736.

Point 1 remains, though I don't think it can ever cause problems. Changing title and downgrading to minor.

Original bug title: "pure and nothrow are not enforced when function has no return type specified"

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