www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18617] New: need __traits(deprecated, expr) to check whether

https://issues.dlang.org/show_bug.cgi?id=18617

          Issue ID: 18617
           Summary: need __traits(deprecated, expr) to check whether an
                    expression would trigger deprecation
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: timothee.cour2 gmail.com

we need __traits(deprecated, expr) to check whether an expression would trigger
deprecation

this is analog to __traits(compiles, expr) but checks for deprecation instead
of whether something compiles.

eg use case (from
https://github.com/dlang/phobos/pull/6178#pullrequestreview-104095990)

```
static assert(__traits(deprecated, {int[] a2 = [1, 2].asStatic;}));
instead of simply having a comment:
// NOTE: correctly issues a deprecation
// int[] a2 = [1, 2].asStatic;
```

--
Mar 15 2018