[Issue 14669] New: auto attribute on function parameter should be error always

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jun 9 04:41:17 PDT 2015


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 at puremagic.com
          Reporter: k.hara.pg at 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`.

--


More information about the Digitalmars-d-bugs mailing list