www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16175] New: allow statements and declaration in a compiles


          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 puremagic.com
          Reporter: greensunny12 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:


Jun 15 2016