Skip to content

Commit

Permalink
Fix Issue 24215 - isBasicType!Enum should be false
Browse files Browse the repository at this point in the history
  • Loading branch information
pbackus authored and dlang-bot committed Nov 2, 2023
1 parent 1c98326 commit 98326c4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion std/traits.d
Original file line number Diff line number Diff line change
Expand Up @@ -6480,7 +6480,8 @@ enum bool isScalarType(T) = __traits(isScalar, T) && is(T : real);
/**
* Detect whether `T` is a basic type (scalar type or void).
*/
enum bool isBasicType(T) = isScalarType!T || is(immutable T == immutable void);
enum bool isBasicType(T) =
!is(T == enum) && (isScalarType!T || is(immutable T == immutable void));

///
@safe unittest
Expand All @@ -6500,6 +6501,13 @@ enum bool isBasicType(T) = isScalarType!T || is(immutable T == immutable void);
static assert(isBasicType!(const(dchar)));
}

// https://issues.dlang.org/show_bug.cgi?id=24215
@safe unittest
{
enum E : int { a }
static assert(!isBasicType!E);
}

/**
* Detect whether `T` is a built-in unsigned numeric type.
*/
Expand Down

0 comments on commit 98326c4

Please sign in to comment.