Hi,

I have some issues with enums. Please have a look at the last 3 assertions. It is annoying that I cannot directly use my StringEnum for startsWith. Therefore I use std.conv.text to convert the string enum? to string. But then the assertion fails, that is very strange, it fails only for string ":" but
not for string "b".

Is this a bug? => Tested with DMD 2.071 on windows.

Kind regards
André

enum ManifestConst = ":";
enum CharEnum { a = ':' }
enum StringEnum{a = ":", b = "b"}

import std.string: startsWith, endsWith;
import std.conv: text;

void main()
{
        assert( ":abc".startsWith(CharEnum.a)); // OK
        assert( ":abc".startsWith(ManifestConst)); // OK
        //assert( "abc".startsWith(StringEnum.a)); // Compiler error
assert( ":abc".startsWith(StringEnum.a.text)); // Assertion failure
        assert( "bc".startsWith(StringEnum.b.text)); // OK ???
}

Reply via email to