www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15963] New: Hidden unresolved forward reference issue in


          Issue ID: 15963
           Summary: Hidden unresolved forward reference issue in std.uni
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

Minimized test case from std.uni module code:

void main()//unittest

struct SliceOverIndexed(T)
    enum assignableSlice = is(typeof({ T.init[0..0] = Item.init; }));

    alias Item = typeof(T.init[0]);
    size_t from, to;
    T* arr;

SliceOverIndexed!T sliceOverIndexed(T)(size_t a, size_t b, T* x)
    return SliceOverIndexed!T(a, b, x);

struct Grapheme
    dchar opIndex(size_t index) const pure nothrow  nogc
        return 'a';

     system auto opSlice(size_t a, size_t b) pure nothrow  nogc
        return sliceOverIndexed(a, b, &this);

     system auto opSlice() pure nothrow  nogc
        return sliceOverIndexed(0, 0, &this);

Two opSlice auto functions in Grapheme depends on a return type of template
function sliceOverIndexed. But the instantiated type SliceOverIndexed!Grapheme
depends on is(typeof({ Grapheme.opSlice(0, 0) = dchar.init; })). In short,
there's an unresolved forward reference issue.

The hiding error is a bug of current dmd, but the Phobos code needs to be fixed

Apr 27 2016