www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18566] New: const on method of nested data type is not

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

          Issue ID: 18566
           Summary: const on method of nested data type is not applied to
                    variables in context
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: timon.gehr gmx.ch

void main(){
    int i = 0;
    struct S{
        int *fun()const pure{
            return &i; // compiles, but shouldn't
        }
    }
}

The type of i within "fun" should be "const(int)".

--
Mar 06 2018