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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 27 14:55:27 PDT 2007


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 at digitalmars.com
        ReportedBy: ary at 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.


-- 



More information about the Digitalmars-d-bugs mailing list