------------ 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
https://github.com/D-Programming-Language/dmd/pull/3617
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