Skip to content

Commit

Permalink
Merge pull request #4898 from ntrel/to-args
Browse files Browse the repository at this point in the history
[trivial] std.conv: Don't allow to!T() in constraint
  • Loading branch information
schveiguy committed Nov 23, 2016
2 parents 7556346 + b612dcd commit 6a059e7
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions std/conv.d
Expand Up @@ -121,17 +121,6 @@ private
enum isNullToStr = isImplicitlyConvertible!(S, T) &&
(is(Unqual!S == typeof(null))) && isExactSomeString!T;
}

template isRawStaticArray(T, A...)
{
enum isRawStaticArray =
A.length == 0 &&
isStaticArray!T &&
!is(T == class) &&
!is(T == interface) &&
!is(T == struct) &&
!is(T == union);
}
}

/**
Expand Down Expand Up @@ -178,14 +167,14 @@ $(I UnsignedInteger):
template to(T)
{
T to(A...)(A args)
if (!isRawStaticArray!A)
if (A.length != 1 || !isStaticArray!(A[0]))
{
return toImpl!T(args);
}

// Fix issue 6175
T to(S)(ref S arg)
if (isRawStaticArray!S)
if (isStaticArray!S)
{
return toImpl!T(arg);
}
Expand Down Expand Up @@ -536,7 +525,7 @@ private T toImpl(T, S)(S value)
Converting static arrays forwards to their dynamic counterparts.
*/
private T toImpl(T, S)(ref S s)
if (isRawStaticArray!S)
if (isStaticArray!S)
{
return toImpl!(T, typeof(s[0])[])(s);
}
Expand Down

0 comments on commit 6a059e7

Please sign in to comment.