Bug 13092 – std.algorithm.cartesianProduct of Nullable Tuple of strings array too

Status
NEW
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-11T08:00:33Z
Last change time
2024-12-01T16:21:48Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
bearophile_hugs
Moved to GitHub: phobos#10070 →

Comments

Comment #0 by bearophile_hugs — 2014-07-11T08:00:33Z
I think all this program should compile: void main() { import std.typecons: Tuple, Nullable; import std.algorithm: cartesianProduct; string[] a; const Nullable!(Tuple!(string[])) b; const string[] c = b.get[0]; // OK foreach (ab; cartesianProduct(a, c)) {} // OK foreach (ab; cartesianProduct(a, b[0])) {} // fails foreach (ab; cartesianProduct(a, b.get[0])) {} // fails } With dmd 2.066beta2 it gives: ...\dmd2\src\phobos\std\algorithm.d(12783,10): Error: static assert "cartesianProduct involving finite ranges must have at least one finite forward range" test.d(8,34): instantiated from here: cartesianProduct!(string[], const(immutable(char)[][]))
Comment #1 by hsteoh — 2014-07-12T15:02:15Z
Weird, seems b[0] and b.get[] must be returning some kind of proxy type, since passing const(string[]) to cartesianProduct works just fine. Either that, or this is a compiler bug that somehow messes up type inference. Will have to investigate a bit more to figure it out.
Comment #2 by robert.schadek — 2024-12-01T16:21:48Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10070 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB