[Issue 1872] New: getVirtualFunctions should return empty if called for a field

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 26 21:11:25 PST 2008


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

           Summary: getVirtualFunctions should return empty if called for a
                    field
           Product: D
           Version: 2.011
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: diagnostic, rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: dhasenan at gmail.com


class Bar
{
    int snafu;
}

string foo()
{
    string s = ``;
    foreach (i, m; __traits(getVirtualFunctions, Bar, "snafu"))
    {
        s ~= `0`;
    }
    return s;
}

foo() should return the empty string. Instead, it fails to compile with an
obscure error message:
test1
0x8171160 typedot type=foreach_virtualfuncs_field.Bar
foreach_virtualfuncs_field.d(9): Error: 'this' is only allowed in non-static
member functions, not foo
foreach_virtualfuncs_field.d(9): Error: this for snafu needs to be type Bar not
type int
test2


-- 



More information about the Digitalmars-d-bugs mailing list