www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10648] New: std.traits.isMutable is true for struct defined immutable

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

           Summary: std.traits.isMutable is true for struct defined
                    immutable
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-07-15 10:13:33 PDT ---
With dmd 2.064alpha this code runs with no assert errors:


import std.traits: isMutable;
immutable struct Foo {}
void main () {
    static assert(isMutable!Foo);
}



Issue found by JS:
http://forum.dlang.org/thread/xjpfwfydzxxwqisvqudw forum.dlang.org

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 15 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10648


Kenji Hara <k.hara.pg gmail.com> changed:

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


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-07-15 18:07:35 PDT ---
(In reply to comment #0)
 With dmd 2.064alpha this code runs with no assert errors:
 
 
 import std.traits: isMutable;
 immutable struct Foo {}
 void main () {
     static assert(isMutable!Foo);
 }
 
 
 
 Issue found by JS:
 http://forum.dlang.org/thread/xjpfwfydzxxwqisvqudw forum.dlang.org
It is not an issue. Because: 1. Qualified struct declaration and its behavior is properly documented. http://dlang.org/struct#ConstStruct 2. The struct name `Foo` always represent 'mutable type Foo'. And, isMutable tests whether the type qualifier is mutable or not. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 15 2013