relax inout rules?
kenji hara
k.hara.pg at gmail.com
Wed Jan 18 18:52:53 PST 2012
2011/12/13 Steven Schveighoffer <schveiguy at yahoo.com>:
> immutable(int) c;
> auto pc = &c;
>
> foo(&pc, &b);
>
> Now, foo is being called with (immutable(int)**, int *). Inout resolves to
> const (due to the mix of mutable and immutable). *NOW* we try calling foo
> as if it were written:
>
> const(int)* foo(const(int)** a, const(int)* b);
>
> And it *FAILS*. This is because you cannot implicitly convert
> immutable(int)** to const(int)** (well, at least it *shouldn't* compile, I'm
> not sure if it does currently).
Today, with git head, this code might be rejected correctly.
So relaxing inout rule is more reasonable now.
Kenji Hara
More information about the Digitalmars-d
mailing list