Thread overview
[Issue 6091] New: [d-p-l.org] Description for "Modifier casting" is misleading
Jan 21, 2012
Walter Bright
June 02, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6091

           Summary: [d-p-l.org] Description for "Modifier casting" is
                    misleading
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: websites
        AssignedTo: nobody@puremagic.com
        ReportedBy: schveiguy@yahoo.com


--- Comment #0 from Steven Schveighoffer <schveiguy@yahoo.com> 2011-06-02 12:36:08 PDT ---
From this page: http://d-programming-language.org/expression.html

------
Casting to a CastQual adds the qualifier to the type of the UnaryExpression.

Casting to the empty ( ) has the effect of removing any top level const or immutable type modifiers from the type of the UnaryExpression.
------

When I read this, I interpret casting to a CastQual as only *adding* the given modifiers, but it actually *replaces* the modifiers.

For example:

shared int x;
assert(is(typeof(cast(const)x) == const int));

Note, shared is *removed* from the modifiers.

For the second statement, casting with ( ) removes shared as well:

shared int x;
assert(is(typeof(cast()x) == int));

Finally, "Casting to the empty ( )" reads poorly.

I would say "Cast with no Type or CastQual inside the parentheses has the effect of removing any top level const, immutable, or shared type modifiers from the type of the UnaryExpression."

I also would like to see examples here, feel free to use my two above.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6091



--- Comment #1 from github-bugzilla@puremagic.com 2012-01-20 22:21:14 PST ---
Commit pushed to https://github.com/D-Programming-Language/d-programming-language.org

https://github.com/D-Programming-Language/d-programming-language.org/commit/fb90864e631c2be8c6cc9f717540354ed4fcb5dc fix Issue 6091 - [d-p-l.org] Description for 'Modifier casting' is misleading

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6091


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


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