www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3272] New: RepresentationTypeTuple! in std.traits does not work for classes.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3272

           Summary: RepresentationTypeTuple! in std.traits does not work
                    for classes.
           Product: D
           Version: 2.029
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: peng2cheng2 yahoo.com


RepresentationTypeTuple! in std.traits does not work for classes.
It does work for structs.
Just not implemented yet?

import std.traits;
import std.stdio;

struct S {
  int a; 
  string s;
}

class C {
  //public: 
  int a = 2;
  string s = "xx";
}

void main (char[][] args) 
{
  //works for struct
  alias RepresentationTypeTuple!(S) SR;
  pragma(msg, "S's field types: " ~ SR[0].stringof ~ ", " ~ SR[1].stringof);


  //same thing for class causes index out of bounds error
  alias RepresentationTypeTuple!(C) CR;
  // pragma(msg, "C's field types: " ~ CR[0].stringof ~ ", " ~ CR[1].stringof);
  pragma(msg, "C's field types? " ~ CR[0].stringof);


  C c = new C;
  writeln(c.a, " ", c.s);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 29 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3272


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |andrei metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 11 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3272


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #1 from Andrei Alexandrescu <andrei metalanguage.com> 2011-01-23
20:14:35 PST ---
Fixed in
https://github.com/D-Programming-Language/phobos/commit/81a4a4034aabe83d41cf2a0a202fedb428da66b6

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 23 2011