Bug 3643 – Compiler error on obtaining typeid of a property
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2009-12-23T18:44:00Z
Last change time
2013-09-26T07:19:55Z
Assigned to
nobody
Creator
pjdeets2
Comments
Comment #0 by pjdeets2 — 2009-12-23T18:44:45Z
See comments in the code below. I don't think this code should get an error.
import std.stdio;
class A {
@property int f() { return 2; }
}
int main() {
A a = new A;
writeln(typeid(a.f())); // works
writeln(typeid(a.f)); // Error: no type for typeid(f)
return 0;
}
Comment #1 by bugzilla — 2009-12-26T01:26:33Z
Should really write these as:
writeln(typeid(typeof(a.f)));
as typeid's argument is supposed to be a type.
Walter: So this is really an error in the spec? Or a bug in DMD? I think that is the latter, but is up to you.
The reason is that if this needs a clarification in the spec, I can do it. But if this is a DMD I don't think I could tackle it.
Comment #4 by andrej.mitrovich — 2013-09-26T07:19:44Z
Fixed by pull in Issue 11010.
*** This issue has been marked as a duplicate of issue 11010 ***