This is the set up I have, and I'm not sure how to get the main
function at the bottom to compile. The error in the code below is
that it cannot implicitly convert an inout(C) to a C in the
constructor of S(T).
If you remove the constructor that takes an inout then you get a
"cannot deduce function from argument types !()(inout(C))"
because there's no constructor that can take in inout.
If you remove the inout form the function "f", then "a.f" cannot
be deduced because there's no f that takes an inout(C).
If you remove the inout from the "make" function, then you get:
"only parameters or stack based variables can be inout."
Anyone knows how to make this work?
struct S(T) {
T value = T.init;
}
auto ref make(T)(inout auto ref T value) {
return S!T(value);
}
auto ref f(T)(inout auto ref S!T s) {
return make(s.value);
}
void main() {
class C {}
const a = S!C();
a.f;
}
Cheers,
- Ali

For some reason, when you call `make("hello")`, the template
argument T is being inferred as char[] instead of string. (You
can see this by putting `pragma(msg, T)` in the body of make.) It
works if you instantiate make explicitly with
`make!string("hello")`.
This seems like a bug to me. If you remove inout from the code, T
is correctly deduced as string.

For some reason, when you call `make("hello")`, the template
argument T is being inferred as char[] instead of string. (You
can see this by putting `pragma(msg, T)` in the body of make.)
It works if you instantiate make explicitly with
`make!string("hello")`.
This seems like a bug to me. If you remove inout from the code,
T is correctly deduced as string.