Skip to content

Commit

Permalink
Fix issue 17340 - isNumeric!bool should not be true
Browse files Browse the repository at this point in the history
  • Loading branch information
tsbockman committed Apr 22, 2017
1 parent 2e33404 commit 2ae83e3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions std/traits.d
Expand Up @@ -5612,15 +5612,15 @@ enum bool isFloatingPoint(T) = __traits(isFloating, T) && !(is(Unqual!T == cfloa
* Detect whether $(D T) is a built-in numeric type (integral or floating
* point).
*/
enum bool isNumeric(T) = __traits(isArithmetic, T) && !(is(Unqual!T == char) ||
enum bool isNumeric(T) = __traits(isArithmetic, T) && !(is(Unqual!T == bool) ||
is(Unqual!T == char) ||
is(Unqual!T == wchar) ||
is(Unqual!T == dchar));

///
@safe unittest
{
static assert(
isNumeric!bool &&
isNumeric!byte &&
isNumeric!short &&
isNumeric!int &&
Expand All @@ -5634,6 +5634,7 @@ enum bool isNumeric(T) = __traits(isArithmetic, T) && !(is(Unqual!T == char) ||

static assert(
!isNumeric!void &&
!isNumeric!bool &&
!isNumeric!char &&
!isNumeric!wchar &&
!isNumeric!dchar
Expand Down

0 comments on commit 2ae83e3

Please sign in to comment.