Bug 3915 – typeid not getting type of offsetof standard property

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-03-09T11:43:00Z
Last change time
2014-02-15T02:42:10Z
Keywords
rejects-valid
Assigned to
nobody
Creator
aldonunez1

Comments

Comment #0 by aldonunez1 — 2010-03-09T11:43:00Z
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.
Comment #1 by andrej.mitrovich — 2013-02-04T18:48:05Z
Works in 2.061.