www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15047] New: "used before set" error with void initialization

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

          Issue ID: 15047
           Summary: "used before set" error with void initialization (only
                    with -O)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: schuetzm gmx.net

// xx.d
int testCopy()
{   
    int a = void;
    int b = void;
    int fun(int x) { int y = x; return y; }
    b = fun(a);
    return b;
}   

# dmd -c -O xx.d
xx.d(7): Error: variable a used before set

# dmd -c xx.d
(no error)

This currently breaks compiling vibe.d with optimization for me:
vibe/core/core.d(1693,11): Error: variable a used before set

I'm going to try and see if I can get digger to work again...

--
Sep 12 2015