Thread overview | ||||||
---|---|---|---|---|---|---|
|
June 04, 2014 [Issue 12850] ICE when passing associative array to template | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=12850 monkeyworks12@hotmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|ICE |ICE when passing | |associative array to | |template --- Comment #1 from monkeyworks12@hotmail.com --- The error given is: dmd: interpret.c:310: static int CompiledCtfeFunction::walkAllVars(Expression*, void*): Assertion `0' failed. When I pass an associative array of type int[Index!5] as an alias to a template. The code is too long to paste here, see the dpaste link for the smallest example I could create. http://dpaste.dzfl.pl/b2918df47beb -- |
June 07, 2014 [Issue 12850] ICE when passing associative array to template | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=12850 --- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> --- Please paste case code directly, or attach the source file. // From http://dpaste.dzfl.pl/b2918df47beb template toTypeTuple(alias range) { import std.range : isInputRange; import std.traits : isArray, isNarrowString; import std.typetuple: TypeTuple; alias Arr = typeof(range); static if (isArray!Arr && !isNarrowString!Arr) { static if (range.length == 0) { alias toTypeTuple = TypeTuple!(); } else static if (range.length == 1) { alias toTypeTuple = TypeTuple!(range[0]); } else { alias toTypeTuple = TypeTuple!(toTypeTuple!(range[0 .. $/2]), toTypeTuple!(range[$/2 .. $])); } } else static if (isInputRange!Arr) { import std.array : array; alias toTypeTuple = toTypeTuple!(array(range)); } else { import std.string : format; static assert (0, format("Cannot transform %s of type %s into a TypeTuple.", range, Arr.stringof)); } } template staticZip(alias values, Indices...) { import std.typetuple; template Pair(T...) if (T.length == 2) { alias Pair = TypeTuple!(T); } static if (Indices.length == 1 && values.length == 1) { alias staticZip = TypeTuple!(Pair!(Indices[0], values[0])); } else { alias staticZip = TypeTuple!(Pair!(Indices[0], values[0]), staticZip!(Indices[1..$], values[1..$])); } } struct Index(int upperBound) if (upperBound > 0) { import std.range; enum range = toTypeTuple!(iota(upperBound)); enum length = range.length; alias rangeType = typeof(range[0]); alias rangeType this; } alias N = Index!5; void main() { import std.typetuple; int[N] arr; pragma(msg, staticZip!(arr, N)); } -- |
June 07, 2014 [Issue 12850] ICE when passing associative array to template | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=12850 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice, pull --- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> --- https://github.com/D-Programming-Language/dmd/pull/3640 -- |
June 08, 2014 [Issue 12850] ICE when passing associative array to template | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=12850 --- Comment #4 from github-bugzilla@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/337c7e5c6382d30479b6f1605b9ff38be5d9b513 fix Issue 12850 - ICE when passing associative array to template https://github.com/D-Programming-Language/dmd/commit/a238493b2c67903f7b1d651953df2ee47b641804 Merge pull request #3640 from 9rnsr/fix12850 Issue 12850 - ICE when passing associative array to template -- |
Copyright © 1999-2021 by the D Language Foundation