View mode: basic / threaded / horizontal-split · Log in · Help
February 29, 2012
[Issue 7613] New: __traits(getMember) on inner unittest: Assertion failure: 'type' on line 6695 in file 'expression.c'
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@puremagic.com
       ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@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: -------
January 08, 2013
[Issue 7613] __traits(getMember) on inner unittest: Assertion failure: 'type' on line 6695 in file 'expression.c'
http://d.puremagic.com/issues/show_bug.cgi?id=7613


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

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


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-08 12:57:47 PST ---
It seems allMembers doesn't iterate through unittests anymore, not even
getMember can fetch the unittest (compiling with -unittest).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home