[Issue 2112] New: the type of undefined variable incorrectly assumed to be int

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 19 18:32:55 PDT 2008


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

           Summary: the type of undefined variable incorrectly assumed to be
                    int
           Product: D
           Version: 2.013
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: bartosz at relisoft.com


The following code compiles, and it shouldn't.

int ToTypeString (T:int) ()
{
    return 1;
}

int ToTypeString (T:string) ()
{
    return 2;
}

void main ()
{
    printf("%d\n", ToTypeString!(typeof(localVariable))());
}
-----------------------------
What it does have to do with is localVariable is not defined, so the compiler
as part of its error recovery declared it as an int. It should have reported
the error.


-- 



More information about the Digitalmars-d-bugs mailing list