[Issue 24587] New: Allow negated qualifiers in cast expressions
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Jun  5 13:07:53 UTC 2024
    
    
  
https://issues.dlang.org/show_bug.cgi?id=24587
          Issue ID: 24587
           Summary: Allow negated qualifiers in cast expressions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: qs.il.paperinik at gmail.com
Allow a `!` in a cast expression to remove specific qualifiers from a type.
Unlike `cast()`, notably `cast(!shared)` removes `shared` only and leaves
`inout` and/or `const` intact if they’re present. More than one can be used and
`!` negates all of them: `cast(!const shared)` removes `const` and `shared`,
but leaves `inout` intact.
Grammar:
```diff
    CastQual:
        cast ( TypeCtors? ) UnaryExpression
+       cast ( ! TypeCtors ) UnaryExpression
```
Note that the `TypeCtors` in the second rule one aren’t optional.
--
    
    
More information about the Digitalmars-d-bugs
mailing list