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



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



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 next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3643




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
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Feb 05 2012
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Sep 26 2013