[Issue 5793] New: Types can't be inferred from template argument types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 28 14:44:04 PDT 2011


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

           Summary: Types can't be inferred from template argument types
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: magnus at hetland.org


--- Comment #0 from Magnus Lie Hetland <magnus at hetland.org> 2011-03-28 14:40:38 PDT ---
The following program fails for me (DMD 2.052):

import std.array, std.container;

template func(T) {
    alias void function(T) func;
}

void G(uint x) {
}

void f(T)(func!T g) { // Won't work, except with (*)
// void f(T)(void function(T) g) {
}

void main() {
    f(&G);
    // f!uint(&G); // (*)
}

With the explicit "void function(T) g" in the argument specification, it works.
Or, if f!uint is specified explicitly. The problem seems to be inferring the
type T "through" the template func().

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