[Issue 8848] Array literals and AA literals are rejected as template value parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 22 14:41:29 PDT 2013


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


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #3 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-08-22 14:41:26 PDT ---
(In reply to comment #2)
> (In reply to comment #1)
> > (In reply to comment #0)
> > > The template spec says that they are valid (both D1 and D2),
> > 
> > So are associative arrays accepted, but simple arrays aren't?
> > 
> > template Foo(int[] X) {}
> > template Bar(int[5] X) {}
> > void main() {}
> 
> No, the current DMD accepts neither arrays or AAs in declarations. But both can
> be passed in template tuple parameters.

W.r.t. arrays, is this just a parser issue? It's odd that we have this
situation:

-----
// template Foo(ubyte[]) { }  // nogo
template Bar(T...) { }     // ok

void main()
{
    enum ubyte[] x = [1, 2];

    // alias y = Foo!(x);
    alias z = Bar!(x);  // ok
}
-----

-- 
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