Thread overview
[Issue 1083] New: classtype.classinfo.name can't be evaluated in compile-time
Mar 28, 2007
d-bugmail
Mar 30, 2007
d-bugmail
Sep 16, 2007
d-bugmail
March 28, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1083

           Summary: classtype.classinfo.name can't be evaluated in compile-
                    time
           Product: D
           Version: 1.010
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: davidl@126.com


template typeadder(T)
{
        const char[] typeadder=T.classinfo.name~"hello";
}

class classa
{
}

void main()
{
        pragma(msg,typeadder!(classa));
}

above should compile

and following throws me insane error message


class MyClass
{
}
class MyClassInLine
{
}

template classcast(T)
{
        const char[] inlinename=T.classinfo.name~"InLine";

        char[] classcastfunc(T.classinfo.name)
        {
                auto ktype= addinline(T.classinfo.name);
                return
        inlinename~" classcast("~T.classinfo.name~" base)
        {
                "~inlinename~" ret;
                ret = cast("~inlinename~")cast(void*)base;
                ret.classinfo.vtbl="~inlinename~".classinfo.vtbl;
                return ret;
        }"
                ;
        }
        mixin(classcastfunc(T.name));

}

void main()
{
        MyClass a= new MyClass;
        MyClassInLine v;
        v.classinfo.vtbl = MyClass.classinfo.vtbl;
        v= classcast!(MyClass)(a);
}

error message:
testclassinfo.d(13): Error: no property 'classinfo' for type
'testclassinfo.MyClass'

Yet MyClass should has the property classinfo


-- 

March 30, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1083





------- Comment #1 from bugzilla@digitalmars.com  2007-03-30 15:32 -------
Please put different bugs in separate bug reports.


-- 

September 16, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1083


davidl@126.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #2 from davidl@126.com  2007-09-15 21:59 -------
i can use stringof to bypass this kind of request. So this should be invalid. cause ClassInfo is a runtime info though which might looks like compile time determined.


--