D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 12838 - Dmd show ICEs when using Tuple and wrong type
Summary: Dmd show ICEs when using Tuple and wrong type
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 major
Assignee: No Owner
URL:
Keywords: ice, pull
Depends on:
Blocks:
 
Reported: 2014-06-01 23:11 UTC by bioinfornatics
Modified: 2014-06-05 21:40 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bioinfornatics 2014-06-01 23:11:01 UTC
------------ CODE
import std.typecons     : Tuple;

struct Data
{
    string a;
}


template toTuple(T){
     static string maker(){
         string statement = "alias toTuple = Tuple!(";
         foreach(const memberName; __traits(allMembers, T))
            statement ~=  typeof(__traits(getMember, T, memberName)).stringof  ~ ",\"" ~ memberName ~ "\", " ;
         statement = statement[0..$-2] ~ ") ;" ; // $-2 to remove extra comma
         return statement;
     }
     mixin( maker() );
}


void main()
{
     alias A = toTuple!Data;    A a;
     a[0] = 1;
     a.x = 1;
}

------------

$ LD_LIBRARY_PATH=/opt/dmd/lib/ /opt/dmd/bin/dmd testBug.d 
dmd: statement.c:714: ErrorStatement::ErrorStatement(): Assertion `global.gaggedErrors || global.errors' failed.
Abandon (core dumped)

------------

a[0] expect a string but here intentionnaly i provide a int to show a dmd bug
Comment 2 github-bugzilla 2014-06-05 21:40:38 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9dde636364f8e13a2479feb523d1c880fbefb237
fix Issue 12838 - Dmd show ICEs when using Tuple and wrong type

https://github.com/D-Programming-Language/dmd/commit/7be3892800a6c98c6d745854f002ea6da4a79261
Merge pull request #3617 from 9rnsr/fix12838

Issue 12838 - Dmd show ICEs when using Tuple and wrong type