[Issue 10884] New: Support for using alias expressions to shorten inferred function types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 24 10:59:04 PDT 2013


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

           Summary: Support for using alias expressions to shorten
                    inferred function types
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-08-24 10:59:03 PDT ---
I tagged this as enhancement but I consider it as borderline bug report:


struct Foo(T) { T x; }
void bar1(T)(Foo!T c) {}
alias F(T) = Foo!T;
void bar2(T)(F!T c) {} // line 4, error
void main() {
    F!int x = Foo!int(1);
    bar1(x); // OK
    bar2(x); // line 8, error
}



dmd 2.064alpha:

test.d(8): Error: template test.bar2 does not match any function template
declaration. Candidates are:
test.d(4):        test.bar2(T)(F!T c)
test.d(8): Error: template test.bar2(T)(F!T c) cannot deduce template function
from argument types !()(Foo!int)


Support for similar code is handy to use alias expressions to shorten code when
the same complex type is used in many function signatures, like in bar2.

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