Luther Tychonievich <> changed:

           What    |Removed                     |Added
                 CC|                            |
           Severity|normal                      |trivial

--- Comment #1 from Luther Tychonievich <> 2009-11-18 
10:30:44 PST ---
This is only a problem with template parameter deduction:

    ref int foo(int x)(int[x] v) if (x>0) { return v[0]; }

    foo!(2)([1,2]); // works
    foo([1,2]);     // gives "only parameters or foreach..." error message

It can be sidestepped by explicit template declaration:

    template foo(int x) if (x>0) {
        ref int foo(int[x] v) { return v[0]; }

    foo([1,2]);     // works

While obviously not as nice as function template syntax, this workaround is not
difficult to read or write and contains full functionality.

I posit the error message is wrong either way: declarations.c line 908 should
    error("only function return types, parameters, and foreach declarations can
be ref");

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to