-------------Example---------------------------------------------------------- auto demo() //otherfile.d { try { throw new Exception("I am become death"); } catch(Exception e) { return e.msg; } } extern(C) 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 executable. * 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)
> auto bad = demo(); //This should not compile I don't see any reason that should not compile.
(In reply to Mike Franklin from comment #1) > > auto bad = demo(); //This should not compile > > I don't see any reason that should not compile. Shouldn't as in doesn't at the moment. More philosophically, I was assuming -betterC code can't call non -betterC code e.g. It uses druntime, although I suppose in the sense that that particular exception doesn't escape the function I don't know. The spec doesn't say whether -betterC code can call code using non -betterC features.
You are right. My mistake. It should not compile when compiling with -betterC.
*** This issue has been marked as a duplicate of issue 19268 ***