[Issue 11046] New: [enh] Pure functions with default and out parameters are allowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 15 13:48:27 PDT 2013


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

           Summary: [enh] Pure functions with default and out parameters
                    are allowed
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: maxim at maxim-fomin.ru


--- Comment #0 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-09-15 13:48:26 PDT ---
extern(C) int printf(const char*, ...);

pure foo(out int arg = x) { }

int x = 1;

void main()
{
   foo();
   printf("%d\n", x); // 0
}

Strictly speaking, spec does not prohibit pure functions from modifying its
arguments. On the other hand, there is no much sense in supporting such code.

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


More information about the Digitalmars-d-bugs mailing list