diff --git a/std/traits.d b/std/traits.d index 2e7a4f6a30b..cc49d76b241 100644 --- a/std/traits.d +++ b/std/traits.d @@ -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 @@ -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. */