www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1872] New: getVirtualFunctions should return empty if called for a field

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: dhasenan 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


-- 
Feb 26 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1872


dhasenan gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE




------- Comment #1 from dhasenan gmail.com  2008-02-27 07:28 -------


*** This bug has been marked as a duplicate of 1723 ***


-- 
Feb 27 2008