[Issue 9665] Structure constant members can not be initialized if have opAssign

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 9 11:02:58 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9665


Maxim Fomin <maxim at maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim at maxim-fomin.ru


--- Comment #8 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-03-09 11:02:57 PST ---
(In reply to comment #0)
> Normally constant members of a structure can be initialized in constructor.
> However this is not possible if they have overloading of assignment operator.
> 
> This restricts usage of complex numbers from std.complex since they are
> structures with opAssign.
> 
> <skipped>

You can do:

f2.value = src;

which doesn't require opAssign as well as doesn't scale as structure grows.
This does not work either when structure has private members.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list