digitalmars.D.bugs - [Issue 11422] New: std.array.assocArray with const tuple values
- d-bugmail puremagic.com (42/42) Nov 02 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11422
http://d.puremagic.com/issues/show_bug.cgi?id=11422 Summary: std.array.assocArray with const tuple values Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc I think both cases need to be accepted or both need to be refused: import std.array: assocArray; import std.range: zip; import std.typecons: Tuple; void main() { auto keys = [10, 20, 30]; const vals1 = [1, 2, 3]; //keys.zip(vals1).assocArray; // OK alias R = Tuple!int; const vals2 = [R(1), R(2), R(3)]; keys.zip(vals2).assocArray; // Error } dmd 2.064beta4 gives: ...\dmd2\src\phobos\std\array.d(249): Error: template std.typecons.Tuple!int.Tuple.opAssign does not match any function template declaration. Candidates are: ...\dmd2\src\phobos\std\typecons.d(504): std.typecons.Tuple!int.Tuple.opAssign(R)(auto ref R rhs) if (areCompatibleTuples!(typeof(this), R, "=")) ...\dmd2\src\phobos\std\array.d(249): Error: template std.typecons.Tuple!int.Tuple.opAssign(R)(auto ref R rhs) if (areCompatibleTuples!(typeof(this), R, "=")) cannot deduce template function from argument types !()(const(Tuple!int)) const test.d(10): Error: template instance std.array.assocArray!(Zip!(int[], const(Tuple!int)[])) error instantiating -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 02 2013