From fa0307e09155b414c4718ea62557024d09b349af Mon Sep 17 00:00:00 2001 From: Paul Backus Date: Sat, 4 Nov 2023 10:57:37 -0400 Subject: [PATCH 1/2] Revert "Fix Issue 24215 - isBasicType!Enum should be false" This reverts commit 98326c477f0f9555ca6ed3671fa4359a680e4c31. --- std/traits.d | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/std/traits.d b/std/traits.d index cc49d76b2..2e7a4f6a3 100644 --- a/std/traits.d +++ b/std/traits.d @@ -6480,8 +6480,7 @@ 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) = - !is(T == enum) && (isScalarType!T || is(immutable T == immutable void)); +enum bool isBasicType(T) = isScalarType!T || is(immutable T == immutable void); /// @safe unittest @@ -6501,13 +6500,6 @@ enum bool isBasicType(T) = 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. */ From 12229f498605957744153e7bfa0fda48736e094e Mon Sep 17 00:00:00 2001 From: Paul Backus Date: Sat, 4 Nov 2023 10:57:37 -0400 Subject: [PATCH 2/2] Revert "Add changelog entry for isBasicType" This reverts commit 1813356ab2bceb0c4675ec2f6f731b3eacb25b76. --- changelog/PR8838.dd | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 changelog/PR8838.dd diff --git a/changelog/PR8838.dd b/changelog/PR8838.dd deleted file mode 100644 index 4672d9ee8..000000000 --- a/changelog/PR8838.dd +++ /dev/null @@ -1,10 +0,0 @@ -isBasicType!T now returns false for enum types - -In the language spec, a basic type is defined to be one of `void`, `bool`, a -built-in integer type, a built-in character type, or a built-in floating-point -type. - -Prior to this release, `isBasicType!T` returned `true` when `T` was either a -basic type, or an `enum` type whose base type was a basic type. Now, it returns -`false` for all `enum` types, and only returns `true` if `T` itself is a basic -type.