[Issue 16175] New: allow statements and declaration in a compiles block

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 15 03:00:01 PDT 2016


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

          Issue ID: 16175
           Summary: allow statements and declaration in a compiles block
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: greensunny12 at gmail.com

it would be sometimes nice to be able to use expressions and statements inside
the compiles block:

```
int c = 5;
static assert(!__traits(compiles,int* cMutable = &c));
```

I understand if the rationale was to keep `compiles` simple, because most
things can be done with expressions.

Anyway, e.g. for teaching this is quite nice:

https://github.com/stonemaster/dlang-tour/pull/144

--


More information about the Digitalmars-d-bugs mailing list