[Issue 18417] Make const and immutable postblit constructors illegal
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 14 15:15:57 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18417
--- Comment #7 from Radu Racariu <radu.racariu at gmail.com> ---
As Steven Schveighoffer asked, how do you see an immutable refcounted struct
working after this change?
Consider this simplified example:
==============================================================
struct RC
{
this (int i) immutable
{
}
this(this)
{
import core.stdc.stdio;
// prints `postblit called on RC`
printf("postblit called on %s", typeof(this).stringof.ptr);
}
}
void main()
{
auto rc1 = immutable RC(1);
auto rc2 = rc1;
static assert(is(typeof(rc2) == immutable(RC)));
}
==============================================================
fixing this bug will imply that the postblit will not compile anymore for the
above example?
--
More information about the Digitalmars-d-bugs
mailing list