[Issue 18566] New: const on method of nested data type is not applied to variables in context

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 6 22:20:53 UTC 2018


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 at puremagic.com
          Reporter: timon.gehr at 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)".

--


More information about the Digitalmars-d-bugs mailing list