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



--- Comment #10 from Andrej Mitrovic <[email protected]> 2013-11-22 
05:15:35 PST ---
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #7)
> > > test.d(5): Error: variable test.main.staticAnonInstance is mutable. Only 
> > > const
> > > or immutable class thread local variable are allowed, not test.BaseClass
> > 
> > Btw, can we do something about this diagnostic? It makes absolutely no 
> > sense at
> > all. Here's a mutable class thread-local variable:
> > 
> > auto a = new Class();
> > 
> > So the diagnostic makes no sense..
> 
> class Class {}
> auto a = new Class();
> 
> testx.d(136): Error: variable testx.a is mutable. Only const or immutable 
> class
> thread local variable are allowed, not testx.Class
> 
> Why doesn't it make sense?

I thought this had something to do with not allowing 'new'ing a class at
compile-time. I don't quite understand where the limitation for TLS
specifically came from, e.g.:

-----
class Class { }
static tls = new Class();  // NG
__gshared glob = new Class();  // ok

void main() { }
-----

Why is one allowed but not the other? And is this documented somewhere?

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

Reply via email to