Skip to content

Commit

Permalink
Merge pull request #5171 from wilzbach/fix-17195
Browse files Browse the repository at this point in the history
Issue 17195 - [Reg 2.074] isFloatingPoint!cfloat is now true
merged-on-behalf-of: Jack Stouffer <jack@jackstouffer.com>
  • Loading branch information
dlang-bot committed Feb 21, 2017
2 parents a66ae2e + 76dd6fe commit d67d487
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion std/traits.d
Expand Up @@ -5341,7 +5341,12 @@ enum bool isIntegral(T) = is(IntegralTypeOf!T) && !isAggregateType!T;
/**
* Detect whether $(D T) is a built-in floating point type.
*/
enum bool isFloatingPoint(T) = __traits(isFloating, T);
enum bool isFloatingPoint(T) = __traits(isFloating, T) && !(is(Unqual!T == cfloat) ||
is(Unqual!T == cdouble) ||
is(Unqual!T == creal) ||
is(Unqual!T == ifloat) ||
is(Unqual!T == idouble) ||
is(Unqual!T == ireal));

@safe unittest
{
Expand Down Expand Up @@ -5371,6 +5376,18 @@ enum bool isFloatingPoint(T) = __traits(isFloating, T);
static assert(!isFloatingPoint!(S!float));
}

// https://issues.dlang.org/show_bug.cgi?id=17195
@safe unittest
{
static assert(!isFloatingPoint!cfloat);
static assert(!isFloatingPoint!cdouble);
static assert(!isFloatingPoint!creal);

static assert(!isFloatingPoint!ifloat);
static assert(!isFloatingPoint!idouble);
static assert(!isFloatingPoint!ireal);
}

/**
* Detect whether $(D T) is a built-in numeric type (integral or floating
* point).
Expand Down

0 comments on commit d67d487

Please sign in to comment.