www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14409] New: false positive "Error: one path skips constructor"

https://issues.dlang.org/show_bug.cgi?id=14409

          Issue ID: 14409
           Summary: false positive "Error: one path skips constructor"
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

Test case:

class B { this(int) {} }
class C : B
{
    this(int n)
    {
        if (true)    // line 6
            super(n);
        else
            assert(0);
    }
}

Output:
test.d(6): Error: one path skips constructor
test.d(4): Error: return without calling constructor

--
Apr 04 2015