www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22706] New: Bad error message when trying to explicitly

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

          Issue ID: 22706
           Summary: Bad error message when trying to explicitly
                    instantiate a function template with an auto ref
                    parameter
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: spoov0.707 gmail.com


void foo(T)(auto ref T arg) {}
alias bar = foo!int;

produces the error message:

test.d(1): Error: `auto` can only be used as part of `auto ref` for template
function parameters
test.d(2): Error: template instance `test.foo!int` error instantiating

which makes not much sense.
The message should instead explain that it is not possible to decide if arg is
passed by ref or not.

--
Jan 26 2022