[Issue 11422] New: std.array.assocArray with const tuple values
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Nov 2 16:07:07 PDT 2013
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 at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2013-11-02 16:07:04 PDT ---
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: -------
More information about the Digitalmars-d-bugs
mailing list