[Issue 12838] New: Dmd show ICEs when using Tuple and wrong type
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jun 1 16:11:01 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12838
Issue ID: 12838
Summary: Dmd show ICEs when using Tuple and wrong type
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: bioinfornatics at gmail.com
------------ 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
--
More information about the Digitalmars-d-bugs
mailing list