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:

           Summary: getVirtualFunctions should return empty if called for a
           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:
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

Feb 26 2008
parent d-bugmail puremagic.com writes:

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