[Issue 11714] New: Improve error message for wrongly initialized thread-local class instances

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 10 02:45:36 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11714

           Summary: Improve error message for wrongly initialized
                    thread-local class instances
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: joseph.wakeling at webdrake.net


--- Comment #0 from Joseph Rushton Wakeling <joseph.wakeling at webdrake.net> 2013-12-10 02:45:33 PST ---
If a developer tries to initialize a static/thread-local class instance with a
value not knowable at compile time, the compiler will object with an error
message as follows:

    Error: variable %s is mutable. Only const or immutable class thread local
variable are allowed, not %s

This easily leads to the wrong conclusion that thread-local class instances
must themselves be const or immutable, rather than the reality that the
initialization value must be.

This error message should be replaced with something more friendly, along the
lines of

    Cannot initialize thread-local class variable %s with a mutable value. 
Only const or immutable initial values are allowed (e.g. null).

Background:
http://forum.dlang.org/post/mailman.408.1386663198.3242.digitalmars-d-learn@puremagic.com

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


More information about the Digitalmars-d-bugs mailing list