Thread overview
[Issue 3643] New: Compiler error on obtaining typeid of a property
Dec 24, 2009
Phil Deets
Dec 26, 2009
Walter Bright
Dec 27, 2009
Phil Deets
Feb 05, 2012
Yao Gomez
Sep 26, 2013
Andrej Mitrovic
December 24, 2009
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: -------
December 26, 2009
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: -------
December 27, 2009
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: -------
February 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3643


Yao Gomez <yao.gomez@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yao.gomez@gmail.com


--- Comment #3 from Yao Gomez <yao.gomez@gmail.com> 2012-02-05 14:09:02 PST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 26, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=3643


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich@gmail.com
         Resolution|                            |DUPLICATE


--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-09-26 07:19:44 PDT ---
Fixed by pull in Issue 11010.

*** This issue has been marked as a duplicate of issue 11010 ***

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