Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue 24215 - isBasicType!Enum should be false #8838

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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