www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7147] New: [CTFE] typeid() should be supported in CTFE

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

           Summary: [CTFE] typeid() should be supported in CTFE
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au



static assert({
    TypeInfo xxx = typeid(Object);
    TypeInfo yyy = typeid(new Error("xxx"));
    return true;
    }());

The first typeid gives:
bug.d(7): Error: Cannot interpret & D17TypeInfo_C6Object6__initZ at compile
time

The second one gives:

bug.d(38): Error: dereference of invalid pointer
'Error("xxx",null,0u,null,null,null)'

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
           Severity|normal                      |enhancement


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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Platform|Other                       |All
         OS/Version|Windows                     |All



14:00:26 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1905

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 17 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7147




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/5d3aff1cc85b89bceaf09c5efa3174f1c823a0e0
Fix issue 7147 typeid() should be supported in CTFE

Recognize the lowering which happens in the front-end, and change
it to a reference to the static 'typeinfo' variable.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 17 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7147


Rainer Schuetze <r.sagitario gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario gmx.de



PDT ---
This code now raises an ICE:

struct S { }
static assert(typeid(S).init.length > 0);

Assertion failure: 'thisval && thisval->op == TOKclassreference' on line 4067
in file 'interpret.c'

If you use a class instead:

class C {}
static assert(typeid(C).init.length > 0);

imp.d(2): Error: static assert  (& D16TypeInfo_C3imp1C6__initZ.init.length >
0u) is not evaluatable at compile time

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