[Issue 8703] Disabling default ctor does not forbid default	construction
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Fri Sep 21 09:04:32 PDT 2012
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=8703
Maxim Fomin <maxim at maxim-fomin.ru> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim at maxim-fomin.ru
--- Comment #2 from Maxim Fomin <maxim at maxim-fomin.ru> 2012-09-21 09:05:26 PDT ---
(In reply to comment #0)
> This code should fail to compile, but doesn't.
> 
> struct S
> {
>     @disable this();
> }
> void main()
> {
>     auto s = S();
> }
Actually it is consistent with current D implementation (whether you like it or
not). The root of this issue is that S() is neither "implicit constructor" nor
struct literal - it is default initializer for struct. Currently structs can be
initialized at runtime by four methods: default initializer, struct literal,
constructor or opCall. In the example you block ctor but not default
initializer. This is why S() works, but S.__ctor() as expected doesn't.
-- 
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