www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4812] New: Basic template syntax is rejected

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4812

           Summary: Basic template syntax is rejected
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: rayerd.wiz gmail.com


--- Comment #0 from Haruki Shigemori <rayerd.wiz gmail.com> 2010-09-04 12:06:11
PDT ---
import std.stdio;

template foo(T) {
    T foo(T t) {
        return t + 1;
    }
}

void main() {
    writeln(foo(1)); // OK
    writeln(foo!(int)(1)); // OK
    writeln(foo!(int).foo(1)); // NG
}

bug_d.d(12): Error: expected 1 function arguments, not 0
bug_d.d(12): Error: no property 'foo' for type 'int'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 04 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4812


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |INVALID


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-12-09
08:43:20 PST ---
This is a case of the eponymous template. foo!(int) becomes an alias to the
inner foo function.

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