Bug 22480 – Lack of template instantiation memoization for failed templates

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-11-04T15:49:02Z
Last change time
2024-12-13T19:19:05Z
Assigned to
No Owner
Creator
Eyal
Moved to GitHub: dmd#20001 →

Comments

Comment #0 by eyal — 2021-11-04T15:49:02Z
Example program: struct T(uint x) { pragma(msg, "Instantiated at ", x); static assert(x == 0); } static assert(is(T!0)); static assert(is(T!0)); static assert(!is(T!1)); static assert(!is(T!1)); // redoes all the work :-( prints: Instantiated at 0u Instantiated at 1u Instantiated at 1u Sometimes, detecting an error in template instantiation can be costly. If the compiler memoized not only template instantiation successes but also failures, it can save compilation time and improve output when pragma(msg, ...) are involved.
Comment #1 by robert.schadek — 2024-12-13T19:19:05Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20001 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB