[Issue 3306] New: bad function/delegate literal generated into header files

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 7 23:42:32 PDT 2009


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

           Summary: bad function/delegate literal generated into header
                    files
           Product: D
           Version: 2.032
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: r.sagitario at gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario at gmx.de> 2009-09-07 23:42:31 PDT ---
While trying to compile tango with dmd 1.046, I ran into the a problem with the
di-header generated for atomic.d. A reduced version that reproduces the bug in
dmd 2.032 aswell is

test.d:

int foo(int function() fn)
{
    return fn();
}

int bar(T)()
{
    return foo(function int (){ return 0; });
}

>dmd -c -H test.d

>dmd -c test.di
test.di(10): found 'function' when expecting '.' following 'int'
test.di(10): found '(' when expecting identifier following 'int.'
test.di(11): found '{' when expecting ';' following 'return statement'
test.di(14): Declaration expected, not ')'
test.di(16): unrecognized declaration

This is caused by a wrong function literal being generated into the di-file:

// D import file generated from 'test.d'
int foo(int function() fn)
{
return fn();
}
template bar(T)
{
int bar()
{
return foo(int function()
{
return 0;
}
);
}
}

Note the difference "foo(int function()..." and "foo(function int ()...".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list