Hi everyone,
I hope I'm not misunderstanding the spec when this won't compile:
---
import std.conv;
enum Test { a = 0 }
void main() {
ulong l = 0;
auto t = l.to!Test;
}
---
It doesn't compile due to the template not instantiating.
If l is an int, uint or byte, it compiles fine. I'm as
On 8/23/13, Matej Nanut wrote:
> It doesn't compile due to the template not instantiating.
It's likely a bug just like in Issue 6893[1], where this won't compile:
-
import std.stdio;
enum E3 : ulong { A, B, C };
void main() {
writeln(E3.C);
}
-
[1] : http://d.puremagic.com/issues/
On 8/22/13 5:00 PM, Andrei Alexandrescu wrote:
On 8/22/13 3:48 PM, Matej Nanut wrote:
Hi everyone,
I hope I'm not misunderstanding the spec when this won't compile:
---
import std.conv;
enum Test { a = 0 }
void main() {
ulong l = 0;
auto t = l.to!Test;
}
---
It doesn't compile due t
On 8/22/13 3:48 PM, Matej Nanut wrote:
Hi everyone,
I hope I'm not misunderstanding the spec when this won't compile:
---
import std.conv;
enum Test { a = 0 }
void main() {
ulong l = 0;
auto t = l.to!Test;
}
---
It doesn't compile due to the template not instantiating.
If l is an in
On Thu, Aug 22, 2013 at 05:00:38PM -0700, Andrei Alexandrescu wrote:
> On 8/22/13 5:00 PM, Andrei Alexandrescu wrote:
> >On 8/22/13 3:48 PM, Matej Nanut wrote:
> >>Hi everyone,
> >>
> >>I hope I'm not misunderstanding the spec when this won't compile:
> >>
> >>---
> >>import std.conv;
> >>enum Test
On 8/23/13, Andrej Mitrovic wrote:
> to!() is used for save conversions
I meant safe.
On 8/23/13, H. S. Teoh wrote:
> Whether to() *should* attempt the conversion
> is a different matter, though.
to!() is used for save conversions, so it should try to convert and
throw an exception if conversion fails. For example:
byte x = to!byte(int.max);
std.conv.ConvOverflowException@conv.d
On Fri, Aug 23, 2013 at 03:37:11AM +0200, Andrej Mitrovic wrote:
> On 8/23/13, H. S. Teoh wrote:
> > Whether to() *should* attempt the conversion
> > is a different matter, though.
>
> to!() is used for save conversions, so it should try to convert and
> throw an exception if conversion fails. Fo
On Thu, Aug 22, 2013 at 06:54:45PM -0700, H. S. Teoh wrote:
> On Fri, Aug 23, 2013 at 03:37:11AM +0200, Andrej Mitrovic wrote:
> > On 8/23/13, H. S. Teoh wrote:
> > > Whether to() *should* attempt the conversion
> > > is a different matter, though.
> >
> > to!() is used for save conversions, so i
Well, that was fast! I'm glad it's fixed. :)
10 matches
Mail list logo