[Issue 7613] New: __traits(getMember) on inner unittest: Assertion failure: 'type' on line 6695 in file 'expression.c'

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 29 11:20:54 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7613

           Summary: __traits(getMember) on inner unittest: Assertion
                    failure: 'type' on line 6695 in file 'expression.c'
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-02-29 11:20:53 PST ---
I was attempting to use is(typeof) or __traits(compiles) to tell if a field of
a struct can be converted to a string. However when __traits(getMember) tries
to return a unittest this causes an ICE:

import std.conv;

struct Foo
{
    int x;
    unittest
    {
    }
}

void test(T)(T t)
{
    foreach (member; __traits(allMembers, T))
    {
        enum testString = "static if( is(typeof( to!string(__traits(getMember,
t, " ~ `"` ~ member ~ `"` ~ "))) )) { };";
        mixin(testString);
    }
}

void main()
{
    Foo foo;
    test(foo);

    __traits(getMember, foo, "__unittest1");
}

Assertion failure: 'type' on line 6695 in file 'expression.c'

The minimal test-case is the last line:
__traits(getMember, foo, "__unittest1");

If it was simply an error it could be caught with is(typeof), but it's an ICE.

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


More information about the Digitalmars-d-bugs mailing list