[Issue 11452] New: template alias doesn't work with default template arguments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 6 05:39:17 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11452

           Summary: template alias doesn't work with default template
                    arguments
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: atila.neves at gmail.com


--- Comment #0 from Atila Neves <atila.neves at gmail.com> 2013-11-06 05:39:16 PST ---
template_alias.d:

struct Foo(uint LENGTH, T = bool) {
}

template Foos(uint SIZE, T = bool) {
    alias Foo!(SIZE, T)[] Foos;
}


void func1(uint num, uint size)(Foo!(size)[]) {
}

void func2(uint num, uint size)(Foos!(size)) {
}

void main() {
    Foo!(4)[] foos;
    func1!(2)(foos); //compiles
    func2!(2)(foos); //doesn't compile
}

dmd template_alias.d
template_alias.d(18): Error: template template_alias.func2 does not match any
function template declaration. Candidates are:
template_alias.d(12):        template_alias.func2(uint num, uint
size)(Foos!(size))
template_alias.d(18): Error: template template_alias.func2(uint num, uint
size)(Foos!(size)) cannot deduce template function from argument types
!(3)(Foo!(4)[])
template_alias.d(18): Error: template instance func2!(3) errors instantiating
template

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


More information about the Digitalmars-d-bugs mailing list