Why are enums with base type string not considered strings?

Bastiaan Veelo Bastiaan at Veelo.net
Sun Mar 14 16:30:47 UTC 2021


On Sunday, 14 March 2021 at 16:09:39 UTC, Imperatorn wrote:
> On Sunday, 14 March 2021 at 10:42:17 UTC, wolframw wrote:
>> enum BoolEnum   : bool   { TestBool   = false }
>> enum CharEnum   : char   { TestChar   = 'A' }
>> enum StringEnum : string { TestString = "Hello" }
>>
>> pragma(msg, isBoolean!BoolEnum);       // true
>> pragma(msg, isSomeChar!CharEnum);      // true
>> pragma(msg, isSomeString!StringEnum);  // false
>>
>> Why does isSomeString not return true for an enum with base 
>> type string
>
> May be a regression?
>
> https://issues.dlang.org/show_bug.cgi?id=16573

Indeed: https://run.dlang.io/is/liSDBZ

It regressed in 2.079.1. Seems to be worth an issue report.

—Bastiaan.


More information about the Digitalmars-d-learn mailing list