www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24096] New: a pure function is in fact impure for local

https://issues.dlang.org/show_bug.cgi?id=24096

          Issue ID: 24096
           Summary: a pure function is in fact impure for local automatic
                    external variables
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: trivial
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: andreiD yopmail.com

void main()
{
        int a;

        //a pure function is in fact impure for local automatic external
variables
        pure void f(){int x = a;}  // compile
        pure void g(){int x; a = x;} // compile

}

--
Aug 21 2023