[Issue 4058] New: Wrong error message with __traits(getMember

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 3 12:01:18 PDT 2010


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

           Summary: Wrong error message with __traits(getMember
           Product: D
           Version: future
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-04-03 12:01:17 PDT ---
struct Test {
    void hello() {}
}
void main() {
    Test t;
    string m = "hello";
    __traits(getMember, t, m)(); // line 7
}


dmd 2.042 gives:

test.d(7): Error: string expected as second argument of __traits getMember
instead of m
test.d(7): Error: function expected before (), not false of type bool


Defining m as const,immutable or enum string avoids this error. So those two
error messages are bad. Something better can be:

test.d(7): Error: the second argument of __traits getMember must be a not
mutable string.

-- 
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