www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20705] New: `-preview=rvaluerefparam` does not work with

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

          Issue ID: 20705
           Summary: `-preview=rvaluerefparam` does not work with template
                    deduction
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: industry
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: pro.mathias.lang gmail.com

Marking as blocker because this is just bad:
```
struct Foo
{
    int a;
}

void bar (T) (const ref T arg) {}

void main ()
{
    bar(Foo(42));
}
```

DMD 2.091:
```
dmd -preview=rvaluerefparam autoref.d
autoref.d(10): Error: template autoref.bar cannot deduce function from argument
types !()(Foo), candidates are:
autoref.d(6):        bar(T)(ref const T arg)
```

--
Mar 29