On 7/11/17 2:12 PM, ag0aep6g wrote:
On 07/10/2017 04:57 PM, ag0aep6g wrote:
----
alias T = int;
T** f(const T** input) pure
{
T** output;
return output;
}
void main()
{
T i;
T* p = &i;
immutable T** r = f(&p);
}
----
[...]
Now change `T` to `alias T = immutable int;`. The program gets
rejected. The error message is: "cannot implicitly convert expression
(f(& p)) of type immutable(int)** to immutable(int**)".
Filed an issue:
https://issues.dlang.org/show_bug.cgi?id=17635
I think this is a legitimate bug.
to make sure this is correct, I added:
pragma(msg, typeof(input).stringof);
And it prints const(immutable(int)**) (as I would have expected, but
wasn't 100% sure).
So there is no way the input can be returned, as immutable(int)** cannot
be implicitly converted from const(immutable(int)**).
I think this is just a missed case in the compiler.
-Steve