View mode: basic / threaded / horizontal-split · Log in · Help
April 02, 2012
[Issue 7809] New: __traits(getMember can be used with a type although the spec says it cannot
http://d.puremagic.com/issues/show_bug.cgi?id=7809

          Summary: __traits(getMember can be used with a type although
                   the spec says it cannot
          Product: D
          Version: D2
         Platform: All
       OS/Version: All
           Status: NEW
         Severity: normal
         Priority: P2
        Component: websites
       AssignedTo: nobody@puremagic.com
       ReportedBy: simendsjo@gmail.com


--- Comment #0 from simendsjo <simendsjo@gmail.com> 2012-04-02 03:07:54 PDT ---
struct S {
 int i;
}

is( typeof(__traits(getMember, S, "i")) == int ) // works

The spec, on the other hand, says it cannot be used on non-static fields.
That's my interpretation.

http://dlang.org/traits.html#getMember

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 08, 2013
[Issue 7809] __traits(getMember can be used with a type although the spec says it cannot
http://d.puremagic.com/issues/show_bug.cgi?id=7809


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
            Status|NEW                         |RESOLVED
                CC|                            |andrej.mitrovich@gmail.com
        Resolution|                            |INVALID


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-08 12:52:23 PST ---
No, the error is in the assignment:

struct S
{
   int i;
}

void main()
{
   __traits(getMember, S, "i") = 1;
}

Error: need 'this' to access member i

The trait docs specifically state that all the trait does is forms an
expression. 

But I don't think we even need it anymore since we can use string mixins,
although it has to be around for backwards-compatibility.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home