[Issue 13488] implicit conversions to immutable broken
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Sep 17 07:10:50 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13488
--- Comment #5 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Sobirari Muhomori from comment #4)
> Doesn't work:
> ---
> struct B
> {
> const(int)[] a;
> }
>
> immutable(B) b(immutable int[] a) pure
> {
> return B(a);
> }
> ---
> Error: cannot implicitly convert expression (B(cast(const(int)[])a)) of type
> B to immutable(B)
It's equivalent with:
struct B
{
const(int)[] a;
}
void main()
{
immutable int[] a;
immutable(B) b = B(a);
// <-- B is not implicitly convertible to immutable(B)
}
--
More information about the Digitalmars-d-bugs
mailing list