www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15650] New: Closure variable access broken in contracts


          Issue ID: 15650
           Summary: Closure variable access broken in contracts
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: code klickverbot.at

The following test case, an adapted version of runnable/test10981.d, fails
using DMD 2.070 (OS X, but that's irrelevant):

auto foo(int i)
    class X1
        void in_nested() in {
            import core.stdc.stdio;
            printf("%d\n", i);
        } body {}

    return new X1;

void main() {
    auto a = foo(1234);

The problem seems to be that the frontend assumes that variable references from
contracts *never* make the variable in question a closureVar, irrespective of
whether the variable accessed is in the direct parent function or further up
the chain.


Feb 06 2016