www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1619] New: "Missing initializer for const field" only reported if an explicit constructor is present

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

           Summary: "Missing initializer for const field" only reported if
                    an explicit constructor is present
           Product: D
           Version: 1.022
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: ary esperanto.org.ar


The following code gives a compiler error:

---
class X {
    const int x;
    this() { }
}
---

main.d(3): constructor main.X.this missing initializer for const field x

But this one:
---
class X {
    const int x;
}
---

compiles correctly. Since the semantic of both files is the same, an error
should also be reported in the second case.


-- 
Oct 27 2007