www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6091] New: [d-p-l.org] Description for "Modifier casting" is misleading

reply d-bugmail puremagic.com writes:
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



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: -------
Jun 02 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6091




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: -------
Jan 20 2012
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Jan 20 2012