www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20086] New: -betterC and "Unrestricted use of compile-time


          Issue ID: 20086
           Summary: -betterC and "Unrestricted use of compile-time
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxhaton gmail.com

auto demo() //otherfile.d
    try {
        throw new Exception("I am become death");
    } catch(Exception e)
        return e.msg;   
void main()
   import otherfile : demo;
   auto bad = demo(); //This should not compile
   enum rad = demo(); //This arguably should as per the
                      //(vague) wording of the spec


The specification implies* that arbitrary CTFE should still be possible,
regardless of whether said code actually makes it into the resulting

* The term "Unrestricted* is not defined, which could make this an enhancement
rather than a bug. Either way this behaviour should be possible (Across module
boundaries, but in the same file raises the question of whether it should
compile or not depend on whether the invalid code is actually used)

Jul 26 2019