www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18994] New: Use noncopyable variable in foreach loop without

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

          Issue ID: 18994
           Summary: Use noncopyable variable in foreach loop without ref
                    results in error message without line number
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: yshuiv7 gmail.com

struct Type2
{
    int opApply(int delegate(ref Type1)) { return 0; }
}

struct Type1
{
     disable this(this);
}

void test()
{
    foreach(b; Type2()) {}
}

This could even crash the compiler when -dip1000 is used.

--
Jun 15 2018