Re: How come isMutable returns true for structs that cannot be modified

2018-07-27 Thread aliak via Digitalmars-d-learn
On Friday, 27 July 2018 at 14:48:06 UTC, Steven Schveighoffer wrote: On 7/27/18 9:10 AM, aliak wrote: import std.traits: isMutable; struct S {     immutable int i = 3; } pragma(msg, isMutable!S); void main() {     S s;     s = S(); } isMutable only takes the type into account, it doesn't

Re: How come isMutable returns true for structs that cannot be modified

2018-07-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/27/18 9:10 AM, aliak wrote: import std.traits: isMutable; struct S {     immutable int i = 3; } pragma(msg, isMutable!S); void main() {     S s;     s = S(); } isMutable only takes the type into account, it doesn't look to see if all the internals are mutable. It literally is

How come isMutable returns true for structs that cannot be modified

2018-07-27 Thread aliak via Digitalmars-d-learn
import std.traits: isMutable; struct S { immutable int i = 3; } pragma(msg, isMutable!S); void main() { S s; s = S(); } And is there a trait that takes the transitivity of immutability in to account? Cheers, - Ali