Issue 22148 - noreturn ICE on templates
Summary: noreturn ICE on templates
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 blocker
Assignee: No Owner
URL:
Keywords: backend
Depends on:
Blocks:
 
Reported: 2021-07-27 09:55 UTC by Temtaime
Modified: 2021-10-12 19:39 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Temtaime 2021-07-27 09:55:47 UTC
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
Comment 1 hsteoh 2021-08-08 22:42:44 UTC
Reproduced problem on latest git 9fb279b9ce80240cc54f82825138ffcee4ff8303

Output:
--------
dmd: src/dmd/backend/cod1.d:4052: Assertion `retregs || !*pretregs' failed.
Aborted
--------

Looks like bug in backend.
Comment 2 kinke 2021-08-09 12:28:38 UTC
(In reply to hsteoh from comment #1)
> Looks like bug in backend.

Yep, works with LDC.
Comment 3 moonlightsentinel 2021-10-12 19:39:28 UTC
Tested with current master (2bd3d7d5eb682cf238cffbee2e1ac1bad8cd2225).

Probably fixed as a side effect of https://github.com/dlang/dmd/pull/13135.