[Issue 3915] New: typeid not getting type of offsetof standard property

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 9 11:43:01 PST 2010


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

           Summary: typeid not getting type of offsetof standard property
           Product: D
           Version: 2.041
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: crimson.magus at gmail.com


--- Comment #0 from Aldo Nunez <crimson.magus at gmail.com> 2010-03-09 11:43:00 PST ---
The expressions typeid( SS.b.offsetof ) and typeid( ss3.b.offsetof ) fail with
the error "no property 'offsetof' for type 'char'".

Using typeof in between makes them work, as in typeid( typeof( SS.b.offsetof )
). Changing "offsetof" to "sizeof" also works.

Here's the sample program:

import std.stdio;

struct SS
{
    char a;
    char b;
}

void main()
{
    SS ss3;
    ss3.a = 'A';
    ss3.b = 'L';

    writeln( SS.b.offsetof );
    //writeln( typeid( SS.b.offsetof ) );      // error

    writeln( ss3.b.offsetof );
    //writeln( typeid( ss3.b.offsetof ) );     // error

    writeln( typeid( typeof( SS.b.offsetof ) ) );
    writeln( typeid( typeof( ss3.b.offsetof ) ) );
}

This problem looks related to bugs #3643 and 1684.
But this one is about not getting the type of the "offsetof" standard property.

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