[Issue 18994] New: Use noncopyable variable in foreach loop without ref results in error message without line number

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 15 17:10:23 UTC 2018


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 at puremagic.com
          Reporter: yshuiv7 at 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.

--


More information about the Digitalmars-d-bugs mailing list