www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14669] New: auto attribute on function parameter should be

https://issues.dlang.org/show_bug.cgi?id=14669

          Issue ID: 14669
           Summary: auto attribute on function parameter should be error
                    always
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

Test case:

void foo1()(auto int a) {}  // line 1
void foo2()(auto int a) {}

void main()
{
    alias f1 = foo1!();  // line 6
    foo2(1);    // no error!?
}

Output:

test.d(1): Error: auto can only be used for template function parameters
test.d(6): Error: template instance test.foo1!() error instantiating

The explicit instantiation foo1!() correctly rejects the invalid function
parameter `auto int a`, but the second IFTI call foo2(1) does not report same
error.

This is not related to `auto ref`.

--
Jun 09 2015