digitalmars.D.bugs - [Issue 16573] New: string-typed enum values pass isSomeString but
- via Digitalmars-d-bugs (35/35) Oct 02 2016 https://issues.dlang.org/show_bug.cgi?id=16573
https://issues.dlang.org/show_bug.cgi?id=16573 Issue ID: 16573 Summary: string-typed enum values pass isSomeString but not isInputRange Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: ryan rcorre.net --- import std.traits, std.range; enum S { foo = "foo" } static assert(isSomeString!S); // true static assert(isInputRange!S); // false --- I would expect that all strings are input ranges, so this result is confusing. In particular, it caused code to break when https://github.com/dlang/phobos/pull/3447 was merged. The following used to work: --- enum S { foo = "foo" } import std.file; assert(S.foo.exists); --- The PR range-ified std.file.exists, which should still allow it to accept all the same types it did before. However, it now fails for S.foo as it is a string but not a range. I think S.foo should either be both a string and a range, or neither. Related: https://issues.dlang.org/show_bug.cgi?id=8508 --
Oct 02 2016