www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 514] New: Misleading error message for static const initialisation

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

           Summary: Misleading error message for static const initialisation
           Product: D
           Version: 0.174
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: trivial
          Priority: P5
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: deewiant gmail.com


class C
{
        static const int x;

        this() {
                x = 2;
        }
}

The above code errors out with "Error: can only initialize const x inside
constructor". This is rather unclear, as x _is_ being initialised inside a
constructor. The compiler should notify that the variable is static and thus
needs to be initialised in a static constructor.


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


deewiant gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #1 from deewiant gmail.com  2006-12-03 03:42 -------
Fixed in DMD 0.176.


-- 
Dec 03 2006