import std; bool throwError(string S, string File = __FILE__, uint Line = __LINE__, A...)(A args) { return throwError(args.format!S, File, Line); } noreturn throwError(T)(T value, string file = __FILE__, uint line = __LINE__) { throw new Exception(value.to!string, file, line); } void main() { try { throwError!`%s`(10); } catch(Exception) {} } Result: Illegal instruction (core dumped) Expected: pass OK
Reproduced problem on latest git 9fb279b9ce80240cc54f82825138ffcee4ff8303 Output: -------- dmd: src/dmd/backend/cod1.d:4052: Assertion `retregs || !*pretregs' failed. Aborted -------- Looks like bug in backend.
(In reply to hsteoh from comment #1) > Looks like bug in backend. Yep, works with LDC.
Tested with current master (2bd3d7d5eb682cf238cffbee2e1ac1bad8cd2225). Probably fixed as a side effect of https://github.com/dlang/dmd/pull/13135.