www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12466] New: Template type parameter should not require a new symbol for deducing a type

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

           Summary: Template type parameter should not require a new
                    symbol for deducing a type
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



17:55:29 CET ---
-----
void foo(Array : C[N], C, size_t N)(Array array) { }

void bar(C[N], C, size_t N)(C[N] array) { }  // NG

void main()
{
    char[2] arr;
    foo(arr);  // ok
    bar(arr);  // NG in declaration
}
-----

$ dmd test.d
 Error: identifier expected for template value parameter
This is a little bit inconsistent with how is() already works. The following is currently allowed: ----- void main() { char[2] arr; { // ok static if (is(typeof(arr) Array : A[N], A, size_t N)) { pragma(msg, Array); // char[2] } } { // also ok static if (is(typeof(arr) /* Array */: A[N], A, size_t N)) { pragma(msg, A[N]); // char[2] } } } ----- Therefore I think we should also allow it in a template (function) declaration as well. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 25 2014