www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 519] New: Invariant not called from autogenerated constructor

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=519

           Summary: Invariant not called from autogenerated constructor
           Product: D
           Version: 0.174
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: deewiant gmail.com


This code should fail regardless of whether the constructor is commented out or
not:

class Foo {
        // this() {}
        invariant {
                assert (false);
        }
}

void main() {
        Foo foo = new Foo();
}

Yet, it only does if the constructor is explicitly specified. The invariant is
not called from the automatically inserted constructor, even though there's no
reason why it shouldn't be.


-- 
Nov 15 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=519


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gim913 gmail.com




------- Comment #1 from smjg iname.com  2009-01-10 11:30 -------
*** Bug 2184 has been marked as a duplicate of this bug. ***


-- 
Jan 10 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=519


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #2 from bearophile_hugs eml.cc 2010-06-17 13:08:26 PDT ---
*** Issue 4331 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 17 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=519


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |bugzilla digitalmars.com


--- Comment #3 from Andrei Alexandrescu <andrei metalanguage.com> 2010-11-26
11:39:12 PST ---
The example needs parens:

class Foo {
    // this() {}
    invariant {
        assert (false);
    }
}

void main() {
    Foo foo = new Foo();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 26 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=519



--- Comment #4 from Andrei Alexandrescu <andrei metalanguage.com> 2010-11-26
11:39:39 PST ---
Forgot to add the actual parens :o).

class Foo {
    // this() {}
    invariant() {
        assert (false);
    }
}

void main() {
    Foo foo = new Foo();
}

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