digitalmars.D.bugs - [Issue 22480] New: Lack of template instantiation memoization for
- d-bugmail puremagic.com (32/32) Nov 04 2021 https://issues.dlang.org/show_bug.cgi?id=22480
https://issues.dlang.org/show_bug.cgi?id=22480 Issue ID: 22480 Summary: Lack of template instantiation memoization for failed templates Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: eyal weka.io 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. --
Nov 04 2021