www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18607] New: using labelled continue in tuple foreach can


          Issue ID: 18607
           Summary: using labelled continue in tuple foreach can break
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: elpenguino+D gmail.com

int test(T...)() pure {
        L:foreach(_; T) {
                continue L;
                return 1;

The only return statement in this function is unreachable, so this returns an
uninitialized int as long as >= 1 template parameter is specified. This should
not have been able to be marked pure.

The pure attribute is automatically inferred but I've explicitly added it here.

Mar 13 2018