[Issue 20139] New: isInputRange!string is false in betterC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 18 16:06:24 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20139

          Issue ID: 20139
           Summary: isInputRange!string is false in betterC
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: snarwin+bugzilla at gmail.com

The following assertion fails when compiling with -betterC:

import std.range.primitives;
static assert(isInputRange!string);

The cause is the narrow-string version of std.range.primitives.front [1], which
calls std.utf.decode [2] on the start of the string. Because decode throws a
UTFException on invalid input, it does not compile with betterC.

[1] https://dlang.org/phobos/std_range_primitives.html#.front
[2] https://dlang.org/phobos/std_utf.html#decode

--


More information about the Digitalmars-d-bugs mailing list