www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3643] New: Compiler error on obtaining typeid of a property

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

           Summary: Compiler error on obtaining typeid of a property
           Product: D
           Version: 2.036
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: pjdeets2 gmail.com


--- Comment #0 from Phil Deets <pjdeets2 gmail.com> 2009-12-23 18:44:45 PST ---
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;
}

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2009-12-26
01:26:33 PST ---
Should really write these as:

    writeln(typeid(typeof(a.f)));

as typeid's argument is supposed to be a type.

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



--- Comment #2 from Phil Deets <pjdeets2 gmail.com> 2009-12-26 16:50:47 PST ---
The documentation says the argument can be a type or an expression.
http://www.digitalmars.com/d/2.0/expression.html#TypeidExpression

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 26 2009