On 10/13/2015 02:07 PM, Nordlöw wrote:
I have defined a struct UTCOffset in
https://github.com/nordlow/justd/blob/master/datetime_ex.d
Everything works as desired except for
import std.conv : to;
assert(UTCOffset(+14, 0).to!string == "UTC+14:00");
which fails as
/usr/include/dmd/phobos/std/conv.d(293,14): Error: template instance
isRawStaticArray!() does not match template declaration
isRawStaticArray(T, A...)
datetime_ex.d(129,29): Error: cannot resolve type for
UTCOffset(cast(ubyte)0u).this(cast(byte)14, cast(ubyte)0u).to!string
I don't understand what's wrong.
Reduced with a workaround:
struct UTCOffset
{
import std.conv : to; // Move to module scope to compile
string toString() const
{
return "hello";
}
}
void main() {
import std.conv : to;
UTCOffset().to!string;
}
This is an issue that I know to be known. :) I think it is about private
definitions (isRawStaticArray) of modules not working outside? or when
in inner scopes? Something like that...
Ali