[Issue 18561] postblit should allow writing const/immutable members just like constructors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 6 20:04:51 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18561

--- Comment #4 from Ajieskola at gmail.com ---
(In reply to anonymous4 from comment #3)
> This passes:
> ---
> struct A
> {
>     int a;
>     this(int b) const { a=b; }
> }
> int main()
> {
>     const A a;
>     assert(a.a==0,"0");
>     a.__ctor(1);
>     assert(a.a==1,"1");
>     return 0;
> }
> ---

I believe it should not. Yes, constructor should be able to do that, but only
when used as a constructor. But it is a separate issue from this one.

--


More information about the Digitalmars-d-bugs mailing list