www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14105] New: Odd compiler error involving immutable char[],

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

          Issue ID: 14105
           Summary: Odd compiler error involving immutable char[],
                    assertThrown, and stride
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: andrei erdani.com

In Phobos' std/utf.d there's a unittest:

unittest // invalid start bytes
{
    import std.exception: assertThrown;
    immutable char[] invalidStartBytes = [
        //0b1111_1000, // indicating a sequence length of 5
        0b1111_1100, // 6
        0b1111_1110, // 7
        0b1111_1111, // 8
        0b1000_0000, // continuation byte
    ];
    foreach(c; invalidStartBytes)
        assertThrown!UTFException(stride([c]));
}

Uncommenting the first element of the array makes the unittest fail. Actually
uncommenting that but commenting another element of the array makes the
unittest pass. The error cannot be reproduced by taking the unittest out.

--
Feb 01 2015