[Issue 3294] New: forward reference to inferred return type of function call

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 3 13:26:55 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3294

           Summary: forward reference to inferred return type of function
                    call
           Product: D
           Version: 2.031
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: 2korden at gmail.com


module Test;

struct SomeInfiniteRange
{
    int front() { return 42; }
    enum empty = false;

    void popFront() {}
}

struct SomeContainer(T)
{
    auto opSlice()
    {
        return SomeInfiniteRange();
    }
}

class Test
{
    void test()
    {
        foreach (int f; _foo[]) {
            // do nothing
        }
    }

    private SomeContainer!(int) _foo;
}

Test.d(23): Error: forward reference to inferred return type of function call
this._foo.opSlice()
Test.d(23): Error: foreach: int is not an aggregate type

Note that the code compiles just fine if SomeContainer is a concrete struct
(not a template)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list