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

           Summary: rejects templated ref return function
           Product: D
           Version: 2.031
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: k-fo...@onu.edu


import std.stdio;

// This works
//ref int x(int[3] p) { return p[0]; }

// This works
//ref T x(T)(T[3] p) { return p[0]; }

// This does not work
//ref int x(size_t N)(int[N] p) if ( N > 0 ) { return p[0]; }

// This does not work
ref T x(T, size_t N)(T[N] p) if ( N > 0 ) { return p[0]; }

int main()
{
    auto a = [1, 2, 3];

    a.x = 42;

    writeln( a );

    return 0;
}

----

$ rdmd test.d
test.d(12): Error: variable test.N only parameters or foreach declarations can
b
e ref
C:\d\dmd.2.031\dmd2\windows\bin\rdmd.exe: Couldn't compile or execute test.d.

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

Reply via email to