[Dlang-internal] Detect CTFE in AssignExp:semantic

Walter Bright via Dlang-internal dlang-internal at puremagic.com
Wed Jan 11 17:19:00 PST 2017


On 1/11/2017 10:51 AM, Andrei Alexandrescu wrote:
> That's what confuses me, it's the read of the temporary not the code inside the
> function. Would branching inside the function help with that? -- Andrei


The example is about 40 lines of code. The way to figure it out is to simplify 
the example.

For starters, replace:

   char[] mangle(T)(const(char)[] fqn, char[] dst = null)

with:

   char[] mangle(const(char)[] fqn)

Note that the template doesn't even use T or dst. Nor does it use 
unsignedToTempString.

Replace numDigits() with 1.

Rewrite the foreach loop to use primitives, then reduce the primitives (like 
removing popFront() which does nothing).

Never going to figure out what is wrong if the example is larded up with 
obfuscation and distraction. I bet it will shrink down to 3 lines that exhibit 
the same issue, at which point the problem will be obvious.


More information about the Dlang-internal mailing list