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

           Summary: Structs with Disabled Default Constructors Also
                    Disable No-Arg Constructors in Classes
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: debio...@gmail.com


--- Comment #0 from Andrew Wiley <debio...@gmail.com> 2011-12-16 13:02:15 PST 
---
Code sample:
```
struct SomeStruct {
       @disable this();
       this(int arg) {
       }
}

class SomeClass {
       private:
       SomeStruct _stuff;

       public:
       this() {
               _stuff = SomeStruct(10);
       }
}

void someFunc() {
       SomeClass obj = new SomeClass(); // Error: default construction is
disabled for type SomeClass
}
```

As you can see, the @disabled constructor in SomeStruct breaks the no-arg
constructor in SomeClass.
Disabling the *default* constructor in SomeClass is correct, but if a no-arg
constructor is implemented, it should be checked against the same rules as
other constructors (and an error should occur if it doesn't initialize the
@disabled struct).

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

Reply via email to