[Issue 1254] New: Using a parameter initialized to void in a compile-time evaluated function doesn't work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 2 10:28:26 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1254

           Summary: Using a parameter initialized to void in a compile-time
                    evaluated function doesn't work
           Product: D
           Version: 1.014
          Platform: PC
               URL: http://www.digitalmars.com/d/function.html
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic, rejects-valid
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: deewiant at gmail.com


int foo() {
        int x = void;
        return bar(x);
}

int bar(int dummy) {
        return 1;
}

const i = foo();

The above results in "Error: variable x is used before initialization" without
a file name or line number.

The Functions page at http://www.digitalmars.com/d/function.html says only that
use of uninitialized variables can give different results at compile time, but
it doesn't disallow it.

There are two bugs: first, the error message should have a file name and line
number, and second, there should be no error message and the code should
compile.


-- 



More information about the Digitalmars-d-bugs mailing list