isMutable!(T) - intended/overlooked behaviour?

Liam McSherry via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 11 06:39:33 PST 2016


Are the results produced by the following program intended 
behaviour for isMutable!(T)?

---
void main()
{
     import std.stdio  : writeln;
     import std.traits : isMutable;

     struct S
     {
         enum size_t constant_0        = 0;
         enum const(size_t) constant_1 = 0;
     }

     __traits(compiles, { S s; s.constant_0 = 1; }).writeln; // 
false

     isMutable!(typeof(S.constant_0)).writeln; // true
     isMutable!(typeof(S.constant_1)).writeln; // false
}
---

I know the documentation for isMutable!(T) says "Returns true if 
T is not const or immutable," but it would make sense to me if it 
returned false when given an enum. Is this maybe something to be 
corrected?


More information about the Digitalmars-d mailing list