Bug 15819 – private import std.array inside class prevents calling instance.array(), giving contradicting error

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-03-22T05:25:00Z
Last change time
2017-07-03T19:36:17Z
Assigned to
nobody
Creator
timothee.cour2

Comments

Comment #0 by timothee.cour2 — 2016-03-22T05:25:31Z
not sure whether it's a dmd or phobos error (or if i missed something) but: void fun(){ // ... alias Range = typeof(temp); static assert(isInputRange!Range); static assert(isIterable!Range && !isNarrowString!Range && !isInfinite!Range); static assert(is(typeof(temp.array))); // CT error } error: Error: cannot resolve type for temp.array(Range)(Range r) if (isIterable!Range && !isNarrowString!Range && !isInfinite!Range) //static assert(is(typeof(temp.array))); single file code here: https://github.com/timotheecour/dtools/blob/master/dtools/util/emit.d using: DMD64 D Compiler v2.070 (same with git head)
Comment #1 by timothee.cour2 — 2016-03-22T05:30:37Z
update: the following passes, ie array(temp) is ok but temp.array is not; why is that? (again, self contained single file test example here: https://github.com/timotheecour/dtools/blob/master/dtools/util/emit.d ) // ... import std.array:array; static assert(is(typeof(array(temp)))); static assert(!is(typeof(temp.array)));
Comment #2 by timothee.cour2 — 2016-03-22T06:52:39Z
reduced case: the issue goes away if we comment "private import std.array;" module bugs.bug_D20160321T233851; /+ dmd -unittest -main -run bugs/bug_D20160321T233851.d +/ import std.traits : isIterable, isNarrowString; import std.range : isInfinite,isInputRange; import std.array; unittest { EmitResult temp; alias Range = typeof(temp); static assert(isInputRange!Range); static assert(isIterable!Range && !isNarrowString!Range && !isInfinite!Range); // BUG:error: cannot resolve type for temp.array(Range)(Range r) if (isIterable!Range && !isNarrowString!Range && !isInfinite!Range) static assert(!is(typeof(temp.array))); static assert(is(typeof(array(temp)))); } private struct EmitResult { // comment this make things "normal" private import std.array; @property bool empty() { return true; } void popFront() { } @property int front() { return 0; } }
Comment #3 by dlang-bugzilla — 2017-07-03T19:36:17Z
Fixed by https://github.com/dlang/dmd/pull/5445. *** This issue has been marked as a duplicate of issue 10378 ***