ref barfs template parameter deduction?

NaN divide at by.zero
Fri May 8 22:04:54 UTC 2020


On Friday, 8 May 2020 at 22:03:47 UTC, NaN wrote:
> Ok given the following code...
>
> auto foo(T)(T x)
> {
>     struct V1 { T* what; }
>     V1 v;
>     return v;
> }
>
> auto bam(T)(T x)
> {
>     struct V2 { T* what; }
>     V2 v;
>     return v;
> }
>
> void bar()
> {
>     bam(foo(1));
> }

Should have said that compiles fine when x is passed by value.


More information about the Digitalmars-d-learn mailing list