[Issue 7021] Structs with disabled default constructors can be constructed without calling a constructor.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 21 09:17:45 PDT 2012


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


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> 2012-09-21 09:18:39 PDT ---
(In reply to comment #7)
> Wait.
> 
> @disable this();
> 
> _is_ the way to disable init. If
> 
> @diasble this();
> 
> was used, then there should be no init property. That's the entire point of
> 
> @disable this;

Why? .init is a property which currently (2.060) can be hijacked. Dmd seems not
to generate an implicit constructor function, it just initialize raw memory
with default values when it faces S(). This is why disabling any function
(ctors too) doesn't prevent it from creating S object.

-- 
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