[Issue 3072] tuples can't be aliases ( except when the aliases are templates. )

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 20 11:00:36 PDT 2010


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


Rob Jacques <sandford at jhu.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid,
                   |                            |rejects-valid, spec
                 CC|                            |sandford at jhu.edu
            Version|1.00                        |D1 & D2
            Summary|tuples can't be aliases     |tuples can't be aliases (
                   |                            |except when the aliases are
                   |                            |templates. )


--- Comment #1 from Rob Jacques <sandford at jhu.edu> 2010-10-20 10:59:44 PDT ---
In general template tuples can't contain alias template parameters but it
appears that there is an exception to this rule when the parameter is itself a
template. 

DMD 2.049

T foo(T)(T t) { return t; }
template map1(fun...) {
    enum map1 = 42;
}
template map2(T, U...) {
    static if(U.length > 0) enum map2 = map2!(U);
    else                    enum map2 = 42;
}

void main() {
    auto x = map1!(char,foo);  // compiles
    auto y = map2!(char,foo);  // doesn't compile
    auto z = map1!(char,map1); // compiles
    auto w = map2!(char,map1); // doesn't compile
    return;
}

I've added the accepts-invalid, rejects-valid and spec keywords, since tuples
of aliases should either work or not-work and the behavior should be documented
in the spec. I'd lean towards not-work, since tuples of aliases seem to be
buggy (i.e. Issue 5087) not to mention that alias parameters are buggy(i.e.
issue 5082)

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